Install Apache+PHP on CentOS server

By | 7 December 2016

Step 1 – Login to your server

Step 2Install Apache web server on CentOS. Issue following command:
yum install httpd

Step 3Install PHP5 and common PHP module. The most basic command to install latest PHP version is following:
yum install php

That’s it. Now you have Apache and PHP5 installed. But wait, talking about PHP module, there are several most common modules available you may wish to install as well. Use the following command

yum install php-mysql php-common php-cli php-devel php-fpm php-gd php-imap php-intl php-mysql php-process php-xml php-xmlrpc php-zts

Step 4 – Finally restart the Apache web server so it can reload appropriately:

service httpd restart

Step 5 – This very last step is not a must but recommended: adding Apache to start up list. Each time you reboot your server PHP will start automatically but not with Apache. Issue command below to make it start each time whenever the server reboots:

chkconfig httpd on

Congratulation. What’s next? You can give it a test by accessing your server in your browser via its IP address