How do I configure PHP5 and Apache2 on Ubuntu Server?

Posted by rofls on Server Fault See other posts from Server Fault or by rofls
Published on 2012-11-27T04:45:27Z Indexed on 2012/11/27 5:08 UTC
Read the original article Hit count: 425

Filed under:
|

I'm trying to follow these instructions (under the Troubleshooting PHP 5 heading). I have PHP installed and when when I run a2enmod php5 it says "Module php5 already enabled". The problem is I created a file, test.php, that's just this:

<?php phpinfo(); ?>

and put it in /var/www, like the instructions tell me to, but running curl http://localhost/test.php produces an Apache made 404 that says it can't find that file. I have:

ServerName localhost DocumentRoot /var/www

in one of the sites-available in the /etc/apache2 directory.

I should probably figure this out on my own, but the instructions say for troubleshooting do:

"If the problem persists, check your PHP file authorisations (it should be readable at least by Ubuntu user "apache"), and check if the PHP code is correct. For instance, copy your PHP file, replace your whole PHP file content by "" (without the quotation marks): if you get the PHP test page in your web browser, then the problem is in your PHP code, not in Apache or PHP configuration nor in file permissions. If this doesn't work, then it is a problem of file authorisation, Apache or PHP configuration, cache not emptied, or Apache not running or not restarted."

And I don't know where the PHP file authorisations are or how to do that.

© Server Fault or respective owner

Related posts about apache2

Related posts about php