Tags

,

How to install PHP5 and Apache on Ubuntu
In your command shell, you will run the following commands:

$ sudo apt-get install apache2
$ sudo apt-get install php5
$ sudo /etc/init.d/apache2 restart

Thats all. In case, you encountered an error like this “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName..” after restarting the Apache server. To fix that problem, you need to edit the httpd.conf file. Type this in your terminal:

$ sudo vi /etc/apache2/httpd.conf

By default httpd.conf file will be blank. Now, add the following line to the file.

ServerName localhost

Save the file and restart the apache2 server

$ sudo /etc/init.d/apache2 restart

To make sure that everything is working fine, create a simple PHP code, save as phpinfo.php:

phpinfo();

Then run it in your browser http://localhost/phpinfo.php, and it will display all PHP information.

Advertisements