linux下运行php脚本,遇到的报错信息:
exec disabled for security reasons
这是因为在 php.ini 文件中,有一行代码对这些方法的使用进行了控制:disable_functions
disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,
ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen
将 exec 去掉以后,就可以实现linux运行exec方法了
disable_functions 限制程序使用一些可以直接执行系统命令的函数 ,这样可以保证服务器的安全,系统命令是不能随意执行的。
当然如果是自己的服务器可以随便玩儿,你可以选择直接把这个参数 disable_functions 注释掉,但是如果是真实的服务器还是进行限制保证安全。