PHP is web scripting programming language that is use for creating dynamic web pages. PHP is supported by Apache and MySQL servers for dynamic updating of website. Hence it is used to develop our very famous WordPress CMS.
PHP is already available with Linux OS, we have to just update it to latest version and install from Library.

Install PHP on Linux server OS
To update PHP and get it started running with other programs like Apache and MySQL, enter following command in Linux Terminal.
1 |
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt |
This will prompt for PHP installation, you have to enter yes then it will complete installation automatically.
By default, web servers are made to server only index.html file only. We need to configure server to read and server php index file. Use following command to change the configuration.
1 |
sudo nano /etc/apache2/mods-enabled/dir.conf |
Add index.php to the beginning of index files. The conf file should look like below:
1 2 3 |
<IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm </IfModule> |
Now make this changes effective, we need to restart Apache using below command.
1 |
sudo service apache2 restart |
Now PHP is successfully updated and installed you Linux server.