Share This:

Installing PHP is by far the easiest part of a LAMP server setup. However it is usually recomended that it gets installed last. This is just the traditional way to do it, and honestly the easiest. If it was setup in different order it would be a lot more head aches. Trust me on this one.




So now we will install PHP on the server which will officially complete our LAMP stack. To do this we will type the following commands.


yum install php php-mysql

Okay so that is pretty much it. But we will want to let Apache know about PHP. But that isn’t much of a problem. We will just restart it by typing the following.


systemctl restart httpd.service

We can install other P’s. They can be installed pretty much the same way. For example lets install Python. To do this we will type the following.


yum install mod_python MySQL-python

Or we can install Perl. To do this we will type the following.


yum install perl mod_perl perl-DBD-mysql

And of course after we install those we would want to also restart Apache as well. So we would issue the usual command for restarting Apache which is the below command.


systemctl restart httpd.service