{"id":1983,"date":"2022-08-22T22:48:40","date_gmt":"2022-08-22T22:48:40","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=1983"},"modified":"2023-02-07T11:06:42","modified_gmt":"2023-02-07T11:06:42","slug":"using-multiple-php-versions-with-apache-on-centos-rhel","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/","title":{"rendered":"Using Multiple PHP Versions with Apache on CentOS \/ RHEL"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en.jpg\" alt=\"Multiple PHP Versions with Apache \non CentOS 7 REDHAT RHEL\" class=\"wp-image-2076\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>To manage numerous domains in a single instance, the Apache web server makes use of virtual hosts. Similar to this, PHP-FPM manages many PHP versions on a single instance using a daemon. Multiple PHP web applications running various versions of PHP can be hosted simultaneously on the same server using Apache and PHP-FPM. This is helpful since some server stacks, like a regularly configured LAMP stack, can only manage one PHP version, even though various apps may need multiple versions. Hosting each programme on its own instance is more expensive; combining Apache with PHP-FPM is less expensive.<\/p>\n\n\n\n<p>For heavily trafficked websites, PHP-FPM additionally provides configuration options for stderr and stdout logging, emergency restarts, and adaptive process spawning. In reality, one of the greatest stacks for hosting PHP applications, particularly in terms of performance, is Apache with PHP-FPM.<\/p>\n\n\n\n<p>You will set up two PHP sites on a single instance in this tutorial. Each website will have its own domain and utilize a different PHP version. The first will launch PHP 8.0 at web1.yourdomain.com. The second will deploy PHP 7.4 at web2.yourdomain.com.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Requirements<\/h2>\n\n\n\n<ul><li>CentOS 7 or Redhat Server.<\/li><li>Apache web server set up and configured.<\/li><li>Domain name configured to point to our server.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 : Installing PHP Versions and Apache<\/h2>\n\n\n\n<p>First, we will install epel repo and then install Apache with the following commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo yum install epel-release -y\n$ sudo yum install httpd<\/code><\/pre>\n\n\n\n<p>After setting up Apache, we&#8217;ll install the Remi repository and then the 80 and 7.4 versions of PHP.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo yum install http:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm\n$ sudo yum install yum-utils \n$ sudo yum install php80 php74\n$ sudo yum install php80-php-fpm php74-php-fpm<\/code><\/pre>\n\n\n\n<p>Both versions of PHP are by default listening on port 9000. However, we wish to run two versions simultaneously in this tutorial. Consequently, let&#8217;s designate two new ports:<\/p>\n\n\n\n<p>You may do this by opening your preferred text editor, going to <kbd>\/etc\/opt\/remi\/php80\/php-fpm.d\/www.conf<\/kbd>, and changing every instance of <kbd>9000<\/kbd> to <kbd>9080<\/kbd>. Repeat the same for <kbd>\/etc\/opt\/remi\/php74\/php-fpm.d\/www.conf<\/kbd>, replacing <kbd>9000<\/kbd> with <kbd>9074<\/kbd> this time, then save and close the file. As an alternative, you may create the replacements using these two sed commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo sed -i 's\/:9000\/:9080\/' \/etc\/opt\/remi\/php80\/php-fpm.d\/www.conf\n$ sudo sed -i 's\/:9000\/:9074\/' \/etc\/opt\/remi\/php74\/php-fpm.d\/www.conf<\/code><\/pre>\n\n\n\n<p>Each of your PHP services now has a unique port that has been set aside for them. However, for these changes to function, you must add the ports to your SELinux setup.<\/p>\n\n\n\n<p>Security Enhanced Linux, or SELinux for short, is turned on by default in CentOS 7. Your new ports <kbd>9080<\/kbd> and <kbd>9074<\/kbd> must be added to your SELinux database and assigned to your httpd services in order for your apps to function. Apply the <kbd>semanage<\/kbd> command to the following action:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo semanage port -a -t http_port_t -p tcp 9080\n$ sudo semanage port -a -t http_port_t -p tcp 9074<\/code><\/pre>\n\n\n\n<p>The php-fpm services can now be started on different ports.<\/p>\n\n\n\n<p>Now you are ready to start and enable your PHP services. Begin with your&nbsp;<kbd>php80-php-fpm<\/kbd>&nbsp;service and enable it to start at boot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl start php80-php-fpm\n$ sudo systemctl enable php80-php-fpm<\/code><\/pre>\n\n\n\n<p>Check your php80-php-fpm service&#8217;s status next:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl status php80-php-fpm<\/code><\/pre>\n\n\n\n<pre title=\"Output\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@centos7 ~]# sudo systemctl status php80-php-fpm\n\u25cf php80-php-fpm.service - The PHP FastCGI Process Manager\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/php80-php-fpm.service; enabled; vendor preset: disabled)\n   Active: active (running) since Fri 2022-08-12 07:16:12 EDT; 14min ago\n Main PID: 65544 (php-fpm)\n   Status: \"Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req\/sec\"\n   CGroup: \/system.slice\/php80-php-fpm.service\n           \u251c\u250065544 php-fpm: master process (\/etc\/opt\/remi\/php80\/php-fpm.conf)\n           \u251c\u250065545 php-fpm: pool www\n           \u251c\u250065546 php-fpm: pool www\n           \u251c\u250065547 php-fpm: pool www\n           \u251c\u250065548 php-fpm: pool www\n           \u2514\u250065549 php-fpm: pool www\n\nAug 12 07:16:12 centos7.linuxvmimages.local systemd[1]: Starting The PHP FastCGI Process Manager...\nAug 12 07:16:12 centos7.linuxvmimages.local systemd[1]: Started The PHP FastCGI Process Manager.<\/code><\/pre>\n\n\n\n<p>Now you are ready to start and enable your PHP services. Begin with your&nbsp;<kbd>php74-php-fpm<\/kbd>&nbsp;service and enable it to start at boot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl start php74-php-fpm\n$ sudo systemctl enable php74-php-fpm<\/code><\/pre>\n\n\n\n<p>Check your php74-php-fpm service&#8217;s status next:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl status php74-php-fpm<\/code><\/pre>\n\n\n\n<pre title=\"Output\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@centos7 ~]# sudo systemctl status php74-php-fpm\n\u25cf php74-php-fpm.service - The PHP FastCGI Process Manager\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/php74-php-fpm.service; enabled; vendor preset: disabled)\n   Active: active (running) since Fri 2022-08-12 07:16:20 EDT; 16min ago\n Main PID: 65556 (php-fpm)\n   Status: \"Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req\/sec\"\n   CGroup: \/system.slice\/php74-php-fpm.service\n           \u251c\u250065556 php-fpm: master process (\/etc\/opt\/remi\/php74\/php-fpm.conf)\n           \u251c\u250065557 php-fpm: pool www\n           \u251c\u250065558 php-fpm: pool www\n           \u251c\u250065559 php-fpm: pool www\n           \u251c\u250065560 php-fpm: pool www\n           \u2514\u250065561 php-fpm: pool www\n\nAug 12 07:16:19 centos7.linuxvmimages.local systemd[1]: Starting The PHP FastCGI Process Manager...\nAug 12 07:16:20 centos7.linuxvmimages.local systemd[1]: Started The PHP FastCGI Process Manager.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Making Directories for Both Websites<\/h2>\n\n\n\n<p>In this section, For each of your two websites, you will create an index page and a document root directory.<\/p>\n\n\n\n<p>First we create directories for our websites <kbd>web1.yourdomain.com<\/kbd> and <kbd>web2.yourdomain.com<\/kbd>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo mkdir \/var\/www\/web1.yourdomain.com\n$ sudo mkdir \/var\/www\/web2.yourdomain.com<\/code><\/pre>\n\n\n\n<p>The Apache user and group are the default for the Apache web server. Therefore, they should also own <kbd>\/var\/www\/<\/kbd> and all of its files and subdirectories. Run the following commands to make sure your website&#8217;s root folders are owned and have the proper permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo chown -R apache:apache \/var\/www\/web1.yourdomain.com\n$ sudo chown -R apache:apache \/var\/www\/web2.yourdomain.com\n$ sudo chmod -R 755 \/var\/www\/web1.yourdomain.com\n$ sudo chmod -R 755 \/var\/www\/web2.yourdomain.com<\/code><\/pre>\n\n\n\n<p>Your two website folders are now owned by the Apache user and group thanks to the <kbd>chown<\/kbd> command. The <kbd>chmod<\/kbd> command modifies that user and group&#8217;s and other people&#8217;s permissions.<\/p>\n\n\n\n<p>The next step is to create an <kbd>info.php<\/kbd> file in the root directory of each website. This will show the PHP version information for each website. starting with <kbd>web1<\/kbd>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/var\/www\/web1.yourdomain.com\/info.php<\/code><\/pre>\n\n\n\n<p>Add the next line:<\/p>\n\n\n\n<pre title=\"\/var\/www\/web1.yourdomain.com\/info.php\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php phpinfo(); ?&gt;<\/code><\/pre>\n\n\n\n<p>Save and copy the file, in the second website:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo cp \/var\/www\/web1.yourdomain.com\/info.php \/var\/www\/web2.yourdomain.com\/info.php<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 : Apache Configuration for Both Websites<\/h2>\n\n\n\n<p>You will build two virtual host configuration files in this step. Your two websites will be able to operate simultaneously with two distinct PHP versions thanks to this.<\/p>\n\n\n\n<p>It is important to construct a virtual host file with the appropriate directives in order for Apache to deliver this content. Within the directory <kbd>\/etc\/httpd\/conf.d\/<\/kbd>, two new virtual host configuration files should be created.<\/p>\n\n\n\n<p>First, create a new virtual host configuration file for the website <kbd>web1.yourdomain.com<\/kbd>. Here, you will direct Apache to render content using PHP 8.0:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/httpd\/conf.d\/web1.yourdomain.com.conf<\/code><\/pre>\n\n\n\n<p>Add the following code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">&lt;VirtualHost *:80>\r\n     ServerAdmin admin@web1.yourdomain.com\r\n     ServerName web1.yourdomain.com\r\n     DocumentRoot \/var\/www\/web1.yourdomain.com\r\n     DirectoryIndex info.php\r\n     SetHandler \"proxy:fcgi:\/\/127.0.0.1:9080\"\r\n     ScriptAlias \/cgi-bin\/ \"\/var\/www\/cgi-bin\/\"\r\n     AddHandler php80-fcgi .php\r\n     Action php80-fcgi \/cgi-bin\/php80.fcgi\r\n     ErrorLog \/var\/log\/httpd\/web1.yourdomain.com_error.log\r\n     CustomLog \/var\/log\/httpd\/web1.yourdomain.com_access.log combined\r\n&lt;\/VirtualHost><\/code><\/pre>\n\n\n\n<p>Let&#8217;s do the same thing for our second server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo nano \/etc\/httpd\/conf.d\/web2.yourdomain.com.conf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"apacheconf\" class=\"language-apacheconf\">&lt;VirtualHost *:80>\r\n     ServerAdmin admin@web2.yourdomain.com\r\n     ServerName web2.yourdomain.com\r\n     DocumentRoot \/var\/www\/web2.yourdomain.com\r\n     DirectoryIndex info.php\r\n     SetHandler \"proxy:fcgi:\/\/127.0.0.1:9074\"\r\n     ScriptAlias \/cgi-bin\/ \"\/var\/www\/cgi-bin\/\"\r\n     AddHandler php74-fcgi .php\r\n     Action php74-fcgi \/cgi-bin\/php74.fcgi\r\n     ErrorLog \/var\/log\/httpd\/web2.yourdomain.com_error.log\r\n     CustomLog \/var\/log\/httpd\/web2.yourdomain.com_access.log combined\r\n&lt;\/VirtualHost><\/code><\/pre>\n\n\n\n<p>When you&#8217;re done, save and shut the file. After that, look for any syntax mistakes in the Apache configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apachectl configtest<\/code><\/pre>\n\n\n\n<pre title=\"Output\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@centos7 ~]# sudo apachectl configtest\nSyntax OK<\/code><\/pre>\n\n\n\n<p>Finally, to apply your modifications, restart the Apache service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl restart httpd<\/code><\/pre>\n\n\n\n<p>Let&#8217;s test each site after setting up Apache to serve it to ensure that the appropriate PHP versions are installed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 : Testing Our Websites<\/h2>\n\n\n\n<p>Open your web browser and visit both sites&nbsp;<kbd>http:\/\/web1.yourdomain.com<\/kbd>&nbsp;and&nbsp;<kbd>http:\/\/web2.yourdomain.com<\/kbd>. You will see two pages that look like this:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><code>http:\/\/web1.yourdomain.com\/<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"945\" height=\"851\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_80.png\" alt=\"web1.yourdomain.com php_info\" class=\"wp-image-2062\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_80.png 945w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_80-300x270.png 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_80-768x692.png 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_80-150x135.png 150w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><code>http:\/\/web2.yourdomain.com\/<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_74.png\" alt=\"web2.yourdomain.com php_info redhat\" class=\"wp-image-2065\" width=\"840\" height=\"729\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_74.png 941w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_74-300x260.png 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_74-768x667.png 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_info_74-150x130.png 150w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure>\n\n\n\n<p>Remove the info.php files after testing your websites. They present a security issue because they give unauthorized users access to private information about your server. Get rid of the files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo rm -rf \/var\/www\/web1.yourdomain.com\/info.php\n$ sudo rm -rf \/var\/www\/web2.yourdomain.com\/info.php<\/code><\/pre>\n\n\n\n<p>You now operate two websites using two distinct PHP versions on a single CentOS 7 server. But PHP-FPM is not just for this one application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Now that virtual hosts and PHP-FPM have been merged, a single server may serve a number of websites and PHP versions. The processing power of your instance is the only real restriction on the amount of PHP sites and PHP versions that your Apache server can support.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To manage numerous domains in a single instance, the Apache web server makes use of virtual hosts. Similar to this, PHP-FPM manages many PHP versions on a single instance using a daemon. Multiple PHP web applications running various versions of PHP can be hosted simultaneously on the same server using Apache and PHP-FPM. This is ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69,4],"tags":[],"yoast_head":"\n<title>Using Multiple PHP Versions with Apache on CentOS \/ RHEL - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will set up two PHP sites on a single instance. Each website will have its own domain and utilize a different PHP version.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Multiple PHP Versions with Apache on CentOS \/ RHEL - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will set up two PHP sites on a single instance. Each website will have its own domain and utilize a different PHP version.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-22T22:48:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-07T11:06:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"Using Multiple PHP Versions with Apache on CentOS \/ RHEL\",\"datePublished\":\"2022-08-22T22:48:40+00:00\",\"dateModified\":\"2023-02-07T11:06:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\"},\"wordCount\":940,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Linux system administration\",\"Web servers\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\",\"name\":\"Using Multiple PHP Versions with Apache on CentOS \/ RHEL - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2022-08-22T22:48:40+00:00\",\"dateModified\":\"2023-02-07T11:06:42+00:00\",\"description\":\"In this tutorial, you will set up two PHP sites on a single instance. Each website will have its own domain and utilize a different PHP version.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Multiple PHP Versions with Apache on CentOS \/ RHEL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"Using Multiple PHP Versions with Apache on CentOS \/ RHEL - WebHi Tutorials &amp; Documentations","description":"In this tutorial, you will set up two PHP sites on a single instance. Each website will have its own domain and utilize a different PHP version.","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:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/","og_locale":"en_US","og_type":"article","og_title":"Using Multiple PHP Versions with Apache on CentOS \/ RHEL - WebHi Tutorials &amp; Documentations","og_description":"In this tutorial, you will set up two PHP sites on a single instance. Each website will have its own domain and utilize a different PHP version.","og_url":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2022-08-22T22:48:40+00:00","article_modified_time":"2023-02-07T11:06:42+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/08\/php_multi_apache_centos_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"Using Multiple PHP Versions with Apache on CentOS \/ RHEL","datePublished":"2022-08-22T22:48:40+00:00","dateModified":"2023-02-07T11:06:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/"},"wordCount":940,"commentCount":2,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Linux system administration","Web servers"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/","url":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/","name":"Using Multiple PHP Versions with Apache on CentOS \/ RHEL - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2022-08-22T22:48:40+00:00","dateModified":"2023-02-07T11:06:42+00:00","description":"In this tutorial, you will set up two PHP sites on a single instance. Each website will have its own domain and utilize a different PHP version.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/using-multiple-php-versions-with-apache-on-centos-rhel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"Using Multiple PHP Versions with Apache on CentOS \/ RHEL"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/1983"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=1983"}],"version-history":[{"count":101,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/1983\/revisions"}],"predecessor-version":[{"id":3697,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/1983\/revisions\/3697"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=1983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=1983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=1983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}