How to set PHP version "per directory" imprimir

  • 2

For example - you have three directories in your public_html - dir1, dir2 and dir3. In all of them you have separate WordPress installations. Lets assume that you need PHP version 5.5 for WordPress'es in dir1 and dir3 and for WordPress in dir2 PHP version 7.0. All you need to do is add following line to your .htaccess files:
- for .htaccess in dir1 and dir3:

AddType application/x-httpd-php55 .php


- for .htaccess in dir2:

AddType application/x-httpd-php70 .php


And you are done :) For testing you can create directories with .htaccess files and with index.php files having phpinfo(); function.

For PHP modules settings for particular PHP version you need to go to cPanel Select PHP Version icon. PHP settings are also available in cPanel Select PHP Version functionality but as always you can set them in your .htaccess files using php_flag or php_value directives.


Esta resposta lhe foi útil?

« Retornar