posix_getpwuid() has been disabled for security reasons

jeroenvip

New member
Joined
Jun 12, 2022
Messages
3
We keep getting this error message in our Nginx logs. Using php 8.1.7 with the custombuild 2.0 and secure_php set to NO

PHP message: PHP Fatal error: Uncaught Error: Call to undefined function xxx\xxxx\posix_getpwuid().

When switching back tot php 7.4 the error is displayed as PHP message: PHP Warning: posix_getpwuid() has been disabled for security reasons

We did rebuild PHP with secure_php set to NO. After rebuilding the posix_getpwuid was still listed inside the disable_functions when executing phpinfo().

Screenshot 2022-06-13 at 04.36.25.png


How can we enable posix_getpwuid ?

Screenshot 2022-06-13 at 04.22.04.png
 
Last edited:
Replying to my own question. After manually disabling the settings below in /usr/local/php81/lib/php.ini the problem was solved. Does this get overwritten with the next php update to 8.1.8 ?

; This directive allows you to disable certain functions.
; It receives a comma-delimited list of function names.
; https://php.net/disable-functions
;disable_functions = exec,system,passthru,shell_exec,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
 
Yes, it does,
Ah, I always change this:
secure_php=no php_ini=no
in options.conf after making custom changes, then it won't be overwritten either.

But the custom thing is better indeed, didn't know about that one. Never seen that in the old docs.
 
After setting secure_php to NO I forgot to set php.ini to yes and rebuild it. Now its working again. A typical RTFM issue. Thanks all for the quick responses.
 
Back
Top