Thursday 20 September 2018

How to enable Multiple PHP versions for websites in CentOS 7



Follow below steps to enable PHP 7.2 for a particular website:

Step 1: change the directory with website Document root directory:

[root@linuxcnf ~]# cd /home/<username>/public_html/demo-website/

Step 2: Create a new file named .htaccess or add the below code at the end in the file if the .htaccess file is already exist:

[root@linuxcnf ~]# vi .htaccess
……
<IfModule mime_module>
  AddType application/x-httpd-ea-php72 .php .php5 .phtml
</IfModule>

Step 3: Save the file and restart apache service to reflect the changes:

[root@linuxcnf ~]# service httpd restart

In the above example, the hosted application from this document root folder will use PHP 7.2

No comments:

Post a Comment