PHP Functions disabled but not disabled in php.ini

RetiredAF

Active Member
Sep 16, 2018
26
5
3
Tucson, AZ
cPanel Access Level
Website Owner
We are moving to a new server and on this server we find that the PHP functions exec,passthru,shell_exec, and system are disabled. We know that from running phpinfo and also when we run a PHP program that uses exec, it warns us that it is disabled. So I thought I would just change this in the php.ini file. Phpinfo tells me the load configuration file is /opt/cpanel/ea-php71/root/etc/php.ini. In there I find:

disable_functions =​

Also when I run php –ini in the terminal I find

disable_functions => no value => no value​

I’ve looked through all the files in /opt/cpanel/ea-php71/root/etc/php.d and don’t find anything there either. Finally, even though it shouldn’t be there, I checked httpd.conf also.

How can this be? Our server does have puppet service installed and running. Could this be doing this and if so how?

Update:

Additionally I changed the php.ini file so

disable_functions = "popen"​

and there was no change in what I see in phpinfo, i.e.,

exec,passthru,shell_exec,system​
Update: I can the run PHP script that uses exec from the command line and it works, but not when it is run from a browser. So it appears apache is disabling the functions somehow. I didn't thing that could be done, but I had looked in the httpd.conf anyway and didn't find anything.

 
Last edited:

andrew.n

Well-Known Member
Jun 9, 2020
463
121
43
EU
cPanel Access Level
Root Administrator
Are you running EasyApache 3 or 4? Under MultiPHP option in WHM can you confirm that the domain is using ea-php71?
 

RetiredAF

Active Member
Sep 16, 2018
26
5
3
Tucson, AZ
cPanel Access Level
Website Owner
We got the answer from our server customer support. This fixed our problem. They said:

There is PHP-FPM enabled for all domains on the server. It overwrites some PHP options, namely disable_functions.​
Thus, if you need these customizations, one should disable PHP-FPM for a domain or globally on the server as it conflicts.​
We have disabled PHP-FPM for xyz.com and restarted Apache. You may do the same from WHM > MultiPHP manager menu.​
 
  • Like
Reactions: andrew.n

kdean

Well-Known Member
Oct 19, 2012
368
59
78
Orlando, FL
cPanel Access Level
Root Administrator
No need to disable PHP-FPM. With PHP-FPM, you can override the disabled functions by either editing / creating:

/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

which will apply to all domains.

Sample with other defaults I have:
Code:
--- 
php_admin_value[error_reporting]: E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
pm_max_children: 5
pm_max_requests: 500
pm_process_idle_timeout: 20
php_admin_value_disable_functions : passthru,system
or edit a specific domain's yaml file in /var/cpanel/userdate/ACCOUNT/DOMAIN.php-fpm.yaml'

Afterward you must rebuild PHP-FPM:

/scripts/php_fpm_config --rebuild

and maybe rebuild Apache:

/scripts/rebuildhttpdconf
 
  • Like
Reactions: RetiredAF