2

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

  • Are you trying to use mod_php or a [F]CGI version? Make sure whatever instructions you're following matches which php5 package you installed. – DerfK Jul 3 '11 at 12:05
  • 1) Do you have PHP installed on your system? 2) Do you have this kind of line in your Apache config LoadModule php5_module libexec/libphp5.so? In other words -- does Apache knows what module to use to process .php files? – LazyOne Jul 3 '11 at 12:07
  • Well, I installed php using: yast2 -i apache2-mod_php5 – Usman Jul 3 '11 at 12:16
  • No. Could find this line in /etc/apache2/httpd.conf. Also there is no libphp5.so on my system. – Usman Jul 3 '11 at 12:22
  • @Usman Here is the general setup instructions: php.net/manual/en/install.unix.apache2.php -- have a look at them. – LazyOne Jul 3 '11 at 13:38
2

Adding php5 to APACHE_MODULES in /etc/sysconfig/apache2 and restarting apache solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.