Jquery中文网 www.jquerycn.cn
Jquery中文网 >  脚本编程  >  php  >  正文 PHP出现Warning: scandir()问题的解决方法

PHP出现Warning: scandir()问题的解决方法

发布时间:2017-08-09   编辑:www.jquerycn.cn
在php编程中,调试一段代码时出现提示:Warning: scandir(),提示php scandir函数有问题,这里分享下我的解决方法,有需要的朋友参考下。

安装博客调试时出现了环境配置问题:
Warning: scandir() has been disabled for security reasons in /home/wwwroot/…
Warning: Invalid argument supplied for foreach() in /home/wwwroot/…
错误。

起初以为是文件权限问题,改了权限没有生效,后来打开phpinfo探针,找到了原因:
php配置中的scandir函数被禁用了。

解决办法:
打开php.ini,找到这行:
 

disable_functions = scandir,passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,
proc_get_statu,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,
readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen

去掉scandir,保存并重起php-fpm即可。

在php开发中,遇到的很多函数问题,都有可能是php禁用了,因此,遇到这类问题时,多看看php.ini配置文件中的相关部分。

您可能感兴趣的文章:
PHP出现Warning: scandir()问题的解决方法
php提示Warning: file_get_contents(): couldn’t resolve
PHP Warning: phpinfo() has been disabled函数禁用
我学PHP--关于session_start()
解决:failed to open stream: No such file or directory in
关于Session的问题集锦解决方案
Warning: session_start() [function.session-start]
php提示 Warning: touch() [function.touch]: Utime failed: Permission denied in错误
解决php导致nginx报502 bad gateway错误问题
php Cannot modify header informationheaders already sent by解决方法

[关闭]