I am using CentOS 6.9, cPanel 64.0 (build 21), PHP 7 with PHP-FPM with some sites and I am having difficulty getting .user.ini files to work recursively. The problem is described and solved here (although not for cPanel):
stackoverflow.com/questions/27226055/does-the-user-ini-file-work-for-subdirectories
Essentially the problem is that cPanel adds a slash to the end of the PHP-FPM proxy address as below:
Looking at the phpinfo for a site with this setting shows that the $_SERVER['SCRIPT_FILENAME'] variable ends up being prepended with a // similar to:
This then has the effect of .user.ini files not being read by sub-directories and can only be rectified by placing another .user.ini in the sub-directory itself, which is obviously not ideal as I want the settings in my webroot .user.ini to be effective across all sub-directories, similar to how php_value settings work in a .htaccess file.
By taking the slash away from the end of the SetHandler line within the httpd.conf file directly and restarting Apache the problem is temporarily solved. However, because of how cPanel works the next rebuild of the httpd.conf file will add the trailing slash again. Although cPanel allows specific virtualhost settings by adding files to the /etc/apache2/conf.d/userdata directory, the include of these settings happens in the httpd.conf file before the SetHandler line is added, meaning we cannot customise this line.
Is there another way to fix this at a global level within my cPanel install?
stackoverflow.com/questions/27226055/does-the-user-ini-file-work-for-subdirectories
Essentially the problem is that cPanel adds a slash to the end of the PHP-FPM proxy address as below:
Code:
SetHandler proxy:unix:/opt/cpanel/ea-php70/root/usr/var/run/php-fpm/5109b0c98599403f47e6e1f35c4510ebc9d8bcfb.sock|fcgi://domain.tld/
Code:
$_SERVER['SCRIPT_FILENAME'] //home/account/app/public_html/info.php
By taking the slash away from the end of the SetHandler line within the httpd.conf file directly and restarting Apache the problem is temporarily solved. However, because of how cPanel works the next rebuild of the httpd.conf file will add the trailing slash again. Although cPanel allows specific virtualhost settings by adding files to the /etc/apache2/conf.d/userdata directory, the include of these settings happens in the httpd.conf file before the SetHandler line is added, meaning we cannot customise this line.
Is there another way to fix this at a global level within my cPanel install?
Last edited by a moderator: