以下设置与预期一样有效.最终,CIFS主机脱机(补丁,电源等).当发生这种情况时……尽管操作系统完全可以访问CIFS共享,但
PHP似乎会失去理智并拒绝访问挂载点中的文件,直到重新启动PHP-fpm.
原文链接:https://www.f2er.com/php/136706.htmlWarning: scandir(repository/Some Series/Some Title): Failed to open dir: No such file or directory in /var/www/audiobooks/libraries/bookScan.PHP on line 169
关于我缺少的任何指针,以便不需要PHP-fpm重启?
我在linux服务器上有以下挂载点:
//10.68.x.x/Media/Audiobooks on /var/www/audiobooks/repository type cifs (rw,relatime,vers=default,cache=strict,username=xxxxxx,domain=/,uid=48,forceuid,gid=996,forcegid,addr=10.68.x.x,file_mode=0755,dir_mode=0775,soft,nounix,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1)
运行以下代码:
public function getBookFiles($book) { $path = $book["path"]; $files = scandir($path); $files = array_diff($files,array('..','.')); return $files; }
补充说明:
PHP-FPM重启修复了该问题.操作系统在中断期间访问这些文件没有问题.
[root@audiobook audiobooks]# stat /var/www/audiobooks/repository/Some\ Series/Some\ Title/01\ Some\ Title.mp3 File: '/var/www/audiobooks/repository/Some Series/Some Title/01 Some Title.mp3' Size: 4170169 Blocks: 8152 IO Block: 16384 regular file Device: 77h/119d Inode: 179 Links: 1 Access: (0555/-r-xr-xr-x) Uid: ( 48/ apache) Gid: ( 996/ Nginx) Access: 2018-03-31 17:09:58.810843700 +0000 Modify: 2018-03-21 20:33:16.000000000 +0000 Change: 2018-04-01 05:58:06.448224400 +0000 Birth: -
PHP版本:
PHP72-PHP.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-PHP-cli.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-PHP-common.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-PHP-fpm.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-PHP-json.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-PHP-mbstring.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-PHP-pdo.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-PHP-pecl-http.x86_64 3.1.1~RC1-2.el7.remi @remi-safe PHP72-PHP-pecl-propro.x86_64 2.0.1-4.el7.remi @remi-safe PHP72-PHP-pecl-raphf.x86_64 2.0.0-5.el7.remi @remi-safe PHP72-PHP-pecl-zip.x86_64 1.15.2-1.el7.remi @remi-safe PHP72-PHP-xml.x86_64 7.2.4-1.el7.remi @remi-safe PHP72-runtime.x86_64 1.0-1.el7.remi @remi-safe