1

I have purchases a server today and I am almost through configuring it, I have managed to install mysql and have enabled a firewall which allows access to ports 80, 22 and 443

I am trying to test out a simple php file to see whether all is well but I get a 404 Not found error, I am certain that this file exists which was created using vi as I have confirmed it using Filezilla.

What am I missing? is there another step that I must take to allow a simple php file to work.

mk_89
  • 125

3 Answers3

1

The file has to be readable by the webserver which usually means by the user www-data. Are you sure your document root is /var/www? Is mod_php enabled?

# sudo apt-get install libapache2-mod-php5
# sudo a2enmod php5

This way apache php support should be enabled. If it says "Module php5 already enabled" everything is fine.

What permissions does /var/www have? And more important, what is the value for DocumentRoot in your apache configuration? (somewhere /etc/apache2/ where your vhosts are defined)

Jens
  • 362
1

Sounds like you need apache or lighttpd

If you didn't pre-configure as a LAMP on install you can follow this ApacheMySQLPHP Ubuntu tutorial

essefbx
  • 143
-2

Did you configure it as a LAMP server during the installation, or did you install apache yourself?

If apache is not already installed you can install it using the command:

sudo aptitude install apache2

Also make sure that the correct permissions are setup for apache to access the directory that contains your php file:

sudo chmod -R 744 /myphpdir
sudo chown -R www-data:www-data /myphpdir
Kev
  • 249