【问题标题】:PHP disable_functions in .user.ini file gives "no value" in phpinfo() output.user.ini 文件中的 PHP disable_functions 在 phpinfo() 输出中给出“无价值”
【发布时间】:2014-08-14 17:59:34
【问题描述】:

我将以下代码放在 apache 虚拟主机文档根目录下的 .user.ini 文件中。当我查看 phpinfo() 输出时, disable_functions 字段显示“没有价值”。请帮我找出原因。

(“memory_limit”和“max_execution_time”设置正确。)

提前致谢。

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

【问题讨论】:

    标签: php php-ini phpinfo


    【解决方案1】:

    @Charles 是对的,PHP 手册明确指出disable_functions 只能在主php.ini 中设置。这显然违背了每个虚拟主机的自定义值。

    如果您启用了 uopz PECL 扩展,则有一个解决方法。详情请查看my other answer

    【讨论】:

      【解决方案2】:

      你需要用"括起来

      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"
      

      【讨论】:

      • 我试过了,但它不起作用。当我将相同的函数列表放在全局 php.ini 文件中时,它就可以工作了。所以格式是正确的。但是我希望不同的 apache 虚拟主机有不同的 disable_functions 列表,这就是为什么我不能把它放到全局 php.ini 中
      • 我怀疑这是正确的答案,这个完全相反:stackoverflow.com/a/16799401/1174784
      【解决方案3】:

      我刚刚仔细查看了php.ini derective page,发现disable_function的可更改字段是php.ini only。所以它只会在全局 php.ini 文件中改变。而且恐怕我必须找到另一种方法来实现我的要求。如果有人能给我一些关于如何将不同的 disable_functions 列表分配给不同的 apache 虚拟主机的建议,那将非常有帮助。干杯。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-06-26
        • 2014-09-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-20
        • 2015-11-17
        • 2021-05-07
        相关资源
        最近更新 更多