PHP file gets download instead of getting executed when browsed in any browser
Posted
by
baltusaj
on Server Fault
See other posts from Server Fault
or by baltusaj
Published on 2011-07-03T11:44:39Z
Indexed on
2012/04/12
11:32 UTC
Read the original article
Hit count: 299
I have a phpinfo.php file which I am trying to run by browsing to it using browser but the browser downloads the file instead of executing it.
phpinfo.php
<?php
phpinfo();
?>
I followed following this post, added following lines to my /etc/apache2/httpd.conf and restarted apache but invain. phpinfo.php still gets downloaded.
AddType application/x-httpd-php .php> .phtml
AddType application/x-httpd-php-source .phps
Have I added these line to the correct file?
On an openSuSE forum following was mentioned. I followed this too but still no success. Same problem is persisting.
In case the browser wants to save your php files instead of displaying the content, you should enable php support in the /etc/apache2/mod_userdir.conf file. Add the following line to it, just after the line and restart the server.
Include /etc/apache2/conf.d/php5.conf
© Server Fault or respective owner