问题
I put the following code in .user.ini file under apache virtual host document root. And when I view the phpinfo() output, the disable_functions fields says "no value". Please help me to figure out why.
(The "memory_limit" and "max_execution_time" are setting correctly.)
Thanks in advance.
memory_limit = 2048M
max_execution_time = 3600
disable_functions = apache_child_terminate,apache_get_modules,apache_getenv,apache_note,apache_setenv,curl_multi_exec,define_syslog_variables,disk_free_space,diskfreespace,dl,fpassthru,ftp_connect,ftp_exec,ftp_get,ftp_login,ftp_nb_fput,ftp_put,ftp_raw,ftp_rawlist,get_current_user,getmyuid,highlight_file,ini_alter,ini_get_all,ini_restore,link,ini_set,mysql_list_dbs,openlog,parse_ini_file,passthru,pclose,pcntl_exec,pfsockopen,php_uname,pcntl_alarm,pcntl_fork,pcntl_get_last_error,pcntl_signal,pcntl_getpriority,pcntl_setpriority,pcntl_strerror,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_waitpid,pcntl_wait,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,popen,posix_getgrgid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,socket_accept,socket_bind,socket_create,socket_create_listen,socket_create_pair,socket_listen,shell_exec,show_source,socket_select,socket_strerror,stream_select,syslog,symlink,system
回答1:
@Charles is right, the PHP Manual clearly states that disable_functions can only be set in the master php.ini. This clearly defeats per-vhost custom value.
There's a workaround for this if you have uopz PECL extension enabled. Check my other answer for details.
回答2:
You need to enclose that with "
disable_functions = "apache_child_terminate,apache_get_modules,apache_getenv,apache_note,apache_setenv,curl_multi_exec,define_syslog_variables,disk_free_space,diskfreespace,dl,fpassthru,ftp_connect,ftp_exec,ftp_get,ftp_login,ftp_nb_fput,ftp_put,ftp_raw,ftp_rawlist,get_current_user,getmyuid,highlight_file,ini_alter,ini_get_all,ini_restore,link,ini_set,mysql_list_dbs,openlog,parse_ini_file,passthru,pclose,pcntl_exec,pfsockopen,php_uname,pcntl_alarm,pcntl_fork,pcntl_get_last_error,pcntl_signal,pcntl_getpriority,pcntl_setpriority,pcntl_strerror,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_waitpid,pcntl_wait,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,popen,posix_getgrgid,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,posix_setuid,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,socket_accept,socket_bind,socket_create,socket_create_listen,socket_create_pair,socket_listen,shell_exec,show_source,socket_select,socket_strerror,stream_select,syslog,symlink,system"
回答3:
I just looked at the php.ini derective page carefully and I found disable_function
's changeable field is php.ini only
. So it will only be changed inside the global php.ini file. And I am afraid that I have to find another way to implement my requirement. If anybody can give me some suggestion about how to assign different disable_functions list to different apache vritual hosts, that will be super helpful. Cheers.
来源:https://stackoverflow.com/questions/24387209/php-disable-functions-in-user-ini-file-gives-no-value-in-phpinfo-output