PHP is_file 为 Ubuntu 上的 Windows 共享返回 false(错误) [英] PHP is_file returns false (incorrectly) for Windows share on Ubuntu

查看:43
本文介绍了PHP is_file 为 Ubuntu 上的 Windows 共享返回 false(错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ubuntu 服务器,PHP 5.3,通过 Samba 连接到 Windows 服务器共享.

Ubuntu server, PHP 5.3, connected via Samba to Windows server share.

我正在使用 file_exists() 检查 Windows 机器上文件的可用性.它返回 false,尽管文件路径确实存在.同时,完全相同的文件路径上的 file_get_contents() 工作正常.

I am using file_exists() to check for availability of file on Windows machine. It returns false, although the filepath does exist. Meanwhile, file_get_contents() on the exact same filepath works fine.

我想知道这是否是权限问题,因为我在 Windows 共享上配置文件权限时遇到问题(它说我无权更改它们的权限).当我通过 Nautilus 查看权限时,它说用户和组都是 root,拥有 755 权限.我想将组更改为 www-data,但似乎无法做到.

I'm wondering if it's a permission issue, since I'm having trouble configuring permissions of the files on the Windows share (it says I don't have permission to change permissions on them). When I look at the permissions through Nautilus, it says the user and group are both root, with 755 rights. I'd like to change the group to www-data, but can't seem to do it.

推荐答案

可能是目录分隔符.试试 preg_replace('%(\\|\)%', '/', $path)

It could be directory seperators. Try preg_replace('%(\\|\)%', '/', $path)

这篇关于PHP is_file 为 Ubuntu 上的 Windows 共享返回 false(错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆