PHP 在 OSX 上包含路径问题
我正在研究 Mac OSX Lion。这是一台新计算机,我正在努力再次设置我的开发环境。
当我尝试包含一个无意义的、不存在的文件时,页面加载正常。
$dir = dirname(__FILE__);
var_dump(include_once($dir . '/sg.php'));
// returns bool(false)
但是,当我尝试包含实际存在的文件时,页面根本无法加载。不用说,我的所有内容现在都无助地损坏了,左右抛出警告。
我已经检查了 php.ini
中的权限、所有权和 include_path
。现在我陷入困境,需要一些帮助。
I'm working on Mac OSX Lion. This is a new computer and I'm working to set up my dev environment again.
When I try to include a nonsense, nonexistent file, the page loads fine.
$dir = dirname(__FILE__);
var_dump(include_once($dir . '/sg.php'));
// returns bool(false)
But when I try to include an actual, existent file, the page fails to load at all. Needless to say, all my includes are helplessly broken right now, throwing warnings left and right.
I've checked perms, ownership, and the include_path
in php.ini
. Now I'm just stuck and could use some help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
您的问题可能不是工作不正常,而是 php.ini 中的 mysql 套接字文件错误。
尝试将其设置为/tmp/mysql.sock。
我的包含文件中有 mysql_connect,它在网页上报告了部分错误消息“没有这样的文件或目录”。当我尝试从命令行调用 index.php 时,它似乎找不到 mysql 套接字文件 - 不是包含的文件;-)
-马切伊
your problem is probably not improperly working include but wrong mysql socket file in php.ini.
Try to set it up to /tmp/mysql.sock.
I had mysql_connect in my included file and it reported partial error message "No such file or directory" on web page. When I tried to call index.php from commandline it appeared that it can't find mysql socket file - not the included file ;-)
-Maciej