What is causing: PHP Fatal error: Call to undefined function exec()?

davidc

Verified User
Joined
Jun 19, 2020
Messages
85
I have read several forum posts and the documentation, but at least 2 domains are still throwing the above issue into the error_log and causing a 500 status code

1. Followed this document: secure_php - with secure_php=yes, php_ini=yes

2. Followed the section at: How to customize the disable_functions list - removed exec() and shell_exec()

Bash:
root@vps:/usr/local/directadmin/custombuild# ./build secure_php
PHP has been secured.
Restarting php-fpm82.
Restarting php-fpm83.

root@vps:# php -i | grep ^disable_functions
disable_functions => no value => no value

root@vps:# grep disable_functions /usr/local/php*/lib/php.ini
/usr/local/php82/lib/php.ini:disable_functions = passthrough,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
/usr/local/php83/lib/php.ini:disable_functions = passthrough,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname

I've turned OFF open_basedir in the user/reseller account of these 2 domains, but cannot discover why exec() will not work.

What am I missing or what else must be checked?

David
 
./build secure_php
That's odd, because if you use that command, exec is always present in the disabled_functions.
Did you edit the php.ini yourself? Because it seems something is wrong.

On the secure_php building it starts like this if I'm not mistaken:
exec,system,passthru,shell_exec,proc_close etc.
in your case it's:
passthrough,proc_close

Did you correct a typo here which is in fact not a typo? Could be causing your php.ini not to work as designed.

Try and see if it makes difference. change passthrough to passthru as it should read and then restart both php-fpm versions. Does that fix your issue?

I've turned OFF open_basedir in the user/reseller account of these 2 domains,
I would set this back on for security reasons, this is not the cause imho.
 
On the secure_php building it starts like this if I'm not mistaken:
exec,system,passthru,shell_exec,proc_close etc.
in your case it's:
passthrough,proc_close

Did you correct a typo here which is in fact not a typo? Could be causing your php.ini not to work as designed.
🙀 Great eyes, Richard. I'm tired after a week of correcting issues!
Try and see if it makes difference. change passthrough to passthru as it should read and then restart both php-fpm versions. Does that fix your issue?
Yes.
I would set this back on for security reasons, this is not the cause imho.
Already turned back on.
 
Back
Top