How to remove extra PHP section from .htaccess
Hi,
In my .htaccess file, there is already a section of PHP, as below:
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (
php_flag display_errors Off
php_value max_execution_time 90
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 512M
php_value post_max_size 4M
php_value session.gc_maxlifetime 2880
php_value upload_max_filesize 4M
php_flag zlib.output_compression Off
php_value session.save_path "/var/cpanel/php/sessions/ea-php73"
# END cPanel-generated php ini directives, do not edit
Then when I try to change the PHP to 8.1 in WHM > MultiPHP Manager, I will get "Access Error". Then I go to cPanel and make the change, it works. But it do not remove the above section, instead, it appending a new section below the above one:
# php -- BEGIN cPanel-generated handler, do not edit
# Set the "ea-php74" package as the default "PHP" programming language.
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
# php -- END cPanel-generated handler, do not edit
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (
php_flag display_errors Off
php_value max_execution_time 90
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 512M
php_value post_max_size 4M
php_value session.gc_maxlifetime 2880
php_value upload_max_filesize 4M
php_flag zlib.output_compression Off
php_value session.save_path "/var/cpanel/php/sessions/ea-php74"
php_flag log_errors On
php_value error_reporting E_ALL
php_value error_log "/home/xxxx/public_html/customer/error_log"
# END cPanel-generated php ini directives, do not edit
I try to remove the first section for PHP 7.3 manually. But after some time, I find it back to .htaccess. So, how to eliminate this section?
-
Hey there! It doesn't look like there are any custom entries in that .htaccess file, so could you try this to empty it? cp /home/xxxx/public_html/.htaccess{,.bak-`date +%Y%m%d`} echo "" > /home/xxxx/public_html/.htaccess That first command will create a backup of the file, and the second will empty it out completely. Then you can try the PHP adjustments again and see what gets put in the file. 0 -
The reason the PHP entries are being appended instead of replaced is because the first entries are for lsapi and modphp. You can easily go into File Manager or SSH and clean up this file. 0 -
Nice catch, @vanessa!!! 0
Please sign in to leave a comment.
Comments
3 comments