PHP stand for Hypertext per-processor. It is a server-side scripting language which is preferably used for developing website and applications. Working of PHP requires interpreter for compiling, after compilation and execution web server sends resulting output to the client. Server side scripting language interacts with server using query which may or may not be included in HTML page. PHP is base for most CMS, WordPress is written in PHP and for properly functioning of WordPress. Server on which PHP would be running for this tutorial is Apache.
Below provides steps on how to install PHP in Ubuntu (Linux) using terminal (Command prompt)
Step 1:- open terminal and type command Sudo apt-get install php5 libapache-2-mod-php5 php5-mcrypt.
Step 2:- While installation, installation would ask for additional 17.3 MB disk space. Type “y”.
Step 3:- It also useful to add PHP to the directory index in order to serve relevant PHP index files. Type command Sudo gedit /etc/apache2/mods-enabled/dir.conf. This command would open dir.conf.
Step 4:- Add “index.php” at the beginning of index files. Following below image shows how the page should be like.
Step 5:- As PHP has variety of useful libraries and modules that can added on virtual server. In order to list all libraries that are available type command apt-cache search php5-.
Step 6:- In order to install type Sudo apt-get install name of the module.
Step 7:- Type php -v in terminal to check php installation as well which version is been installed.