Install Apache Server and PHP on CentOS Print

  • 119

Install Apache:

Run the following command:

          sudo yum install httpd mod_ssl

Once the installation is completed, you need to stat the Apache manually by running the below command:

          sudo service httpd restart

Config Apache:

Open the Apache config file by running the below command: 

          sudo nano /etc/httpd/conf/httpd.conf

Note: use nano Editor, If it's not installed on your server, then run the below command to install nano editor 

          sudo yum install nano

Then, locate the ServerName in the apache config file as mentioned below:

ServerName www.example.com:80

Enter your server Hostname or fully qualified domain name. In the following example:

EX: ServerName YOUR_HOST_NAME 

Then, Restart the Apache

           sudo service httpd restart

Test Apache:

Navigate to your server IP - http://YOUR_SERVER_IP

If the default CentOS Apache “welcome” screen is displayed, the installation was successful. 
Contact CtrlSwitches support if you have any problems.

Install PHP:

Run the following command to install PHP: 

           sudo yum install php php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml 

Then, restart the Apache server

           sudo service httpd restart

You have successfully installed Apache server and PHP on your server!!


Was this answer helpful?

« Back