How to Configure PHP Version in .htaccess
Using a shared server often presents limitations, such as being unable to modify the PHP version. However, it is possible to override the default PHP version using the .htaccess file. Here's a step-by-step guide to achieve this.
Changing PHP Version via .htaccess
Locate the .htaccess file in your server's document root directory. If it doesn't exist, create one.
Edit the .htaccess file and add the following code:
<IfModule mod_php5.c> AddHandler application/x-httpd-php5 .php </IfModule>
This code will override the server's default PHP version with PHP 5.0. To change to other PHP versions, replace the "php5" with the desired version, e.g., php4, php5.3, php5.6, or php7.
Supported PHP Versions
The following code lines correspond to specific PHP versions:
Additional Notes
The above is the detailed content of How to Override Default PHP Version Using .htaccess?. For more information, please follow other related articles on the PHP Chinese website!