The solution to the invalid solution of changing PHP version in .htaccess file
P粉315680565
P粉315680565 2023-08-25 14:06:16
0
2
709
<p>I'm trying to change the PHP version by adding a handler in the .htaccess file at the root of the domain, but it doesn't work, the server throws a 403 Forbidden error. However, changing the PHP selector options via Cpanel works. But I don't want to change the PHP version globally on the server because some of my applications hosted on the server are using an older PHP version, which is 7.4. </p> <p>This is the handler I use in .htaccess for PHP 8.1: </p> <pre class="brush:php;toolbar:false;"># php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php81" package as the default "PHP" programming language. <IfModule mime_module> AddHandler application/x-httpd-ea-php81 .php .php8 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit</pre> <p>Please tell me what I did wrong? </p>
P粉315680565
P粉315680565

reply all(2)
P粉761718546

AddHandler application/x-httpd-ea-php81___lsphp .php .php8 .phtml .htm Please keep the html code and no need to add new content

P粉300541798

403 Forbidden errors are mainly caused by your error handler code.

Try using the following code, it should work fine.

AddHandler application/x-httpd-php81 .php

Or use the following code

AddHandler application/x-httpd-alt-php81___lsphp .php

If this is useful to you, please let me know in the comments.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template