Install php Ubuntu
You will need to open a new terminal window to do this which can be quickly done by pressing CTRL+ALT+T. Then you can run the following command.
sudo apt-get install php
During the installation you might be asked for some information like what type of web server you are running. If you followed the LAMP tutorial on this site then just pick Apache2 and hit enter. It will also ask you if you would like it to configure a database that is required, say yes to make life easier for you.
After this it will ask you for the databases administrator user password as-well as the password you want to use for php, it will finish installing the rest automatically afterwards.
After you finished all of this you might have to restart Apache or run the following command to reconfigure php. (It messed up during installation for me this time but never before, I fixed it thanks to this post.)
sudo /etc/init.d/apache2 restart (Restarts Apache)
sudo dpkg-reconfigure php (Reconfigure php like during installation with a few other small settings.)
You should now have php running and be able to access it by either going to http://localhost/php or php. I hope this post has helped you install php on Ubuntu, please don’t forget to share/like/plus-one! Thanks.