Changing PHP Version via .htaccess on Shared Server
If you're operating a shared server and need to change the PHP version, it's possible to do so through the .htaccess file. This allows you to run a specific PHP version for your website while the server maintains its default version.
To switch PHP versions, follow these steps:
# To switch to PHP 4.4:
AddHandler application/x-httpd-php4 .php
# To switch to PHP 5.0:
AddHandler application/x-httpd-php5 .php
# To switch to PHP 5.1:
AddHandler application/x-httpd-php51 .php
# To switch to PHP 5.2:
AddHandler application/x-httpd-php52 .php
# To switch to PHP 5.3:
AddHandler application/x-httpd-php53 .php
# To switch to PHP 5.4:
AddHandler application/x-httpd-php54 .php
# To switch to PHP 5.5:
AddHandler application/x-httpd-php55 .php
# To switch to PHP 5.6:
AddHandler application/x-httpd-php56 .php
# To switch to PHP 7:
AddHandler application/x-httpd-php7 .php
# To switch to PHP 7.1:
AddHandler application/x-httpd-php71 .php
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3