当前位置:K88软件开发文章中心编程语言PHPPHP01 → 文章内容

tp5出现scandir() has been disabled for security reasons问题

减小字体 增大字体 作者:linux123     来源:asp编程网  发布时间:2018-12-30 6:11:13

今天将thinkphp5项目放到nginx服务器上去,配置好相关的参数后,运行www.***.com/public/后出现警告:
Warning: scandir() has been disabled for security reasons in /home/wwwroot/…
先打开phpinfo.php看一下,发现php函数scandir()被禁用,原来是这个原因导致了这个错误。
了解了错误的原因,就好解决了
解决办法:
1、先找到php.ini文件,使用vim命令打开它,再找到
    disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server
    将这字符串中间的scandir删除掉并保存。
2、使用linux命令重启php
   a、先关闭PHP
      killall php-fpm 
   b、php重启
      /usr/local/php/sbin/php-fpm &


tp5出现scandir() has been disabled for security reasons问题