{"id":24272,"date":"2022-02-02T14:27:24","date_gmt":"2022-02-02T14:27:24","guid":{"rendered":"https:\/\/1-grid.com\/knowledge\/centos-installing-apache-and-php\/"},"modified":"2023-03-06T08:20:05","modified_gmt":"2023-03-06T08:20:05","slug":"centos-installing-apache-and-php","status":"publish","type":"ht_kb","link":"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/","title":{"rendered":"CentOS &#8211; Installing Apache and PHP"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"has-black-color has-text-color\">This article will show you How to Install Apache and PHP&nbsp;<\/p>\n<\/blockquote>\n\n\n<div class=\"WordSection1\">\n<h3 style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 0in; vertical-align: baseline;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\"><strong>Install Apache<\/strong><\/span><\/h3>\n<p>\u00a0<\/p>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l1 level1 lfo2; vertical-align: baseline;\"><span style=\"color: #000000;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\"><span style=\"mso-list: Ignore;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0<\/span><\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Run the following command:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo yum install httpd mod_ssl<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l1 level1 lfo2; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Because the server doesn\u2019t start automatically when you install Apache, you must start it manually by using the following command:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo \/usr\/sbin\/apachectl start<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; line-height: 18.0pt; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\">The following message displays:<\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; mso-line-height-alt: 14.4pt; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0 Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; mso-line-height-alt: 14.4pt; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l1 level1 lfo2; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">5.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Open the main Apache configuration file by using the following command:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">6.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo nano \/etc\/httpd\/conf\/httpd.conf<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l1 level1 lfo2; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">7.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Toward the end of the file, locate the code comment that starts with\u00a0<\/span><code><span style=\"font-size: 10pt; font-family: Tahoma, sans-serif; border: 1pt none windowtext; padding: 0in; background: #ededed;\">ServerName<\/span><\/code><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">\u00a0and provides an example name:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">8.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0#ServerName <a href=\"http:\/\/www.example.com:80\" rel=\"noreferrer\">www.example.com:80<\/a><\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l1 level1 lfo2; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">9.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Enter your Server host name. In the following example, the host name is\u00a0<\/span><code><span style=\"font-size: 10pt; font-family: Tahoma, sans-serif; border: 1pt none windowtext; padding: 0in; background: #ededed;\">demo<\/span><\/code><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">10.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0ServerName demo<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l1 level1 lfo2; vertical-align: baseline; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">11.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Reload Apache by using the following command:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">12.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo \/usr\/sbin\/apachectl restart<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l1 level1 lfo2; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<h3 style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 0in; vertical-align: baseline; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\">Open the port to run Apache<\/span><\/h3>\n<p>\u00a0<\/p>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 0in; line-height: 18.0pt; vertical-align: baseline; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\">Apache runs on port 80. In some versions of CentOS, a firewall that is installed by default blocks access to this port. Perform the following steps to open the port:<\/span><\/p>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l2 level1 lfo4; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\"><span style=\"mso-list: Ignore;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0<\/span><\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Run the following command:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l2 level1 lfo4; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l2 level1 lfo4; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l2 level1 lfo4; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Use the following command to save your firewall rules so that your web server is accessible the next time that you reboot:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l2 level1 lfo4; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo service iptables save<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l2 level1 lfo4; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<h3 style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 0in; vertical-align: baseline; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\">Test the Apache installation<\/span><\/h3>\n<p>\u00a0<\/p>\n<p style=\"margin: 0in; margin-bottom: .0001pt; line-height: 18.0pt; vertical-align: baseline;\">\u00a0<\/p>\n<h3 style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 0in; vertical-align: baseline; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\"><strong>Configure Apache to run automatically<\/strong><\/span><\/h3>\n<p>\u00a0<\/p>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 0in; line-height: 18.0pt; vertical-align: baseline; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\">After Apache is installed and working, use the following steps to set it to start automatically when the server is rebooted:<\/span><\/p>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l3 level1 lfo6; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\"><span style=\"mso-list: Ignore;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0<\/span><\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Run the following command:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l3 level1 lfo6; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo \/sbin\/chkconfig httpd on<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l3 level1 lfo6; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l3 level1 lfo6; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Run the following test to confirm that the setting works:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l3 level1 lfo6; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">4.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo \/sbin\/chkconfig --list httpd<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l3 level1 lfo6; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l3 level1 lfo6; vertical-align: baseline;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">5.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0httpd \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a00:off\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1:off\u00a0 2:on\u00a0\u00a0\u00a0 3:on\u00a0\u00a0\u00a0 4:on\u00a0\u00a0\u00a0 5:on\u00a0\u00a0\u00a0 6:off<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l3 level1 lfo6; vertical-align: baseline;\"><code><\/code><\/pre>\n<h3 style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 0in; vertical-align: baseline; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\"><strong>Install PHP and reload Apache<\/strong><\/span><\/h3>\n<p>\u00a0<\/p>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 0in; line-height: 18.0pt; vertical-align: baseline; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; orphans: 2; text-align: start; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; word-spacing: 0px;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif; color: #000000;\">Use the following steps to install PHP and reload Apache:<\/span><\/p>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l0 level1 lfo8; vertical-align: baseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\"><span style=\"mso-list: Ignore;\">1.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0<\/span><\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Run the following command:<\/span><\/span><\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l0 level1 lfo8; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in;\"><span style=\"mso-list: Ignore;\">2.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0 <\/span><\/span><\/span><\/code><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\">\u00a0sudo yum install php php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<pre style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 22.5pt; margin-left: 15.0pt; text-indent: -.25in; mso-line-height-alt: 14.4pt; mso-list: l0 level1 lfo8; vertical-align: baseline; overflow: auto;\"><code><\/code><\/pre>\n<p style=\"mso-margin-top-alt: 0in; margin-right: 0in; margin-bottom: 26.25pt; margin-left: 15.0pt; text-indent: -.25in; line-height: 18.0pt; mso-list: l0 level1 lfo8; vertical-align: baseline; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; font-style: inherit; font-variant: inherit; font-stretch: inherit;\"><span style=\"color: #000000;\"><span style=\"mso-list: Ignore;\">3.<span style=\"font: 7.0pt 'Times New Roman';\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span><\/span><span style=\"font-size: 16pt; font-family: Tahoma, sans-serif;\">Use the following command to reload Apache:<\/span><\/span><\/p>\n<pre style=\"margin-left: 15.0pt; line-height: 18.0pt; vertical-align: baseline; overflow: auto;\"><code><span style=\"font-size: 16.0pt; font-family: 'Tahoma',sans-serif; color: white; border: none windowtext 1.0pt; padding: 0in; background: #3B3F45;\"> sudo \/usr\/sbin\/apachectl restart<\/span><\/code><\/pre>\n<p>\u00a0<\/p>\n<p class=\"MsoNormal\">\u00a0<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>This article will show you How to Install Apache and PHP&nbsp; Install Apache \u00a0 1.\u00a0\u00a0Run the following command: 2.\u00a0 \u00a0sudo yum install httpd mod_ssl \u00a0 3.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Because the server doesn\u2019t start automatically when you install Apache, you must start it manually by using the following command: 4.\u00a0 \u00a0sudo \/usr\/sbin\/apachectl start \u00a0&#8230;<\/p>\n","protected":false},"author":21,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"ht-kb-category":[24],"ht-kb-tag":[97,178,470,524,738],"class_list":["post-24272","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-website","ht_kb_tag-apache","ht_kb_tag-centos","ht_kb_tag-hosting","ht_kb_tag-install","ht_kb_tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CentOS - Installing Apache and PHP - 1-grid Knowledge Base<\/title>\n<meta name=\"description\" content=\"This article will show you How to Install Apache and PHP\u00a0CentOS - Installing Apache and PHP 1-grid Knowledge Base -\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CentOS - Installing Apache and PHP - 1-grid Knowledge Base\" \/>\n<meta property=\"og:description\" content=\"This article will show you How to Install Apache and PHP\u00a0CentOS - Installing Apache and PHP 1-grid Knowledge Base -\" \/>\n<meta property=\"og:url\" content=\"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/\" \/>\n<meta property=\"og:site_name\" content=\"1-grid Knowledge Base\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/1grid.co.za\/\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-06T08:20:05+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@1grid_hosting\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/\",\"name\":\"CentOS - Installing Apache and PHP - 1-grid Knowledge Base\",\"isPartOf\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#website\"},\"datePublished\":\"2022-02-02T14:27:24+00:00\",\"dateModified\":\"2023-03-06T08:20:05+00:00\",\"description\":\"This article will show you How to Install Apache and PHP\u00a0CentOS - Installing Apache and PHP 1-grid Knowledge Base -\",\"breadcrumb\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/1grid.co.za\/knowledge\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CentOS &#8211; Installing Apache and PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#website\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/\",\"name\":\"1-Grid Domain Hosting Knowledge Base\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/1grid.co.za\/knowledge\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#organization\",\"name\":\"1-Grid Domain Hosting Knowledge Base\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg\",\"contentUrl\":\"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg\",\"width\":100,\"height\":100,\"caption\":\"1-Grid Domain Hosting Knowledge Base\"},\"image\":{\"@id\":\"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/1grid.co.za\/\",\"https:\/\/twitter.com\/1grid_hosting\",\"https:\/\/www.instagram.com\/1grid_hosting\/\",\"https:\/\/za.linkedin.com\/company\/1-grid\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CentOS - Installing Apache and PHP - 1-grid Knowledge Base","description":"This article will show you How to Install Apache and PHP\u00a0CentOS - Installing Apache and PHP 1-grid Knowledge Base -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/","og_locale":"en_US","og_type":"article","og_title":"CentOS - Installing Apache and PHP - 1-grid Knowledge Base","og_description":"This article will show you How to Install Apache and PHP\u00a0CentOS - Installing Apache and PHP 1-grid Knowledge Base -","og_url":"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/","og_site_name":"1-grid Knowledge Base","article_publisher":"https:\/\/www.facebook.com\/1grid.co.za\/","article_modified_time":"2023-03-06T08:20:05+00:00","twitter_card":"summary_large_image","twitter_site":"@1grid_hosting","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/","url":"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/","name":"CentOS - Installing Apache and PHP - 1-grid Knowledge Base","isPartOf":{"@id":"https:\/\/1grid.co.za\/knowledge\/#website"},"datePublished":"2022-02-02T14:27:24+00:00","dateModified":"2023-03-06T08:20:05+00:00","description":"This article will show you How to Install Apache and PHP\u00a0CentOS - Installing Apache and PHP 1-grid Knowledge Base -","breadcrumb":{"@id":"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/1grid.co.za\/knowledge\/centos-installing-apache-and-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/1grid.co.za\/knowledge\/"},{"@type":"ListItem","position":2,"name":"CentOS &#8211; Installing Apache and PHP"}]},{"@type":"WebSite","@id":"https:\/\/1grid.co.za\/knowledge\/#website","url":"https:\/\/1grid.co.za\/knowledge\/","name":"1-Grid Domain Hosting Knowledge Base","description":"","publisher":{"@id":"https:\/\/1grid.co.za\/knowledge\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/1grid.co.za\/knowledge\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/1grid.co.za\/knowledge\/#organization","name":"1-Grid Domain Hosting Knowledge Base","url":"https:\/\/1grid.co.za\/knowledge\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/","url":"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg","contentUrl":"https:\/\/1grid.co.za\/knowledge\/wp-content\/uploads\/2023\/01\/1-grid-logo-color.svg","width":100,"height":100,"caption":"1-Grid Domain Hosting Knowledge Base"},"image":{"@id":"https:\/\/1grid.co.za\/knowledge\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/1grid.co.za\/","https:\/\/twitter.com\/1grid_hosting","https:\/\/www.instagram.com\/1grid_hosting\/","https:\/\/za.linkedin.com\/company\/1-grid"]}]}},"_links":{"self":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/comments?post=24272"}],"version-history":[{"count":2,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24272\/revisions"}],"predecessor-version":[{"id":31475,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb\/24272\/revisions\/31475"}],"wp:attachment":[{"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/media?parent=24272"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb-category?post=24272"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/1grid.co.za\/knowledge\/wp-json\/wp\/v2\/ht-kb-tag?post=24272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}