Can';设置Apache/主机需求后,是否查看Zend Framework 1.0的index.php?
更新:Apache错误日志中出现以下错误Can';设置Apache/主机需求后,是否查看Zend Framework 1.0的index.php?,php,apache,zend-framework,virtualhost,Php,Apache,Zend Framework,Virtualhost,更新:Apache错误日志中出现以下错误 [Sat Dec 08 16:41:39 2012] [error] [client 127.0.0.1] PHP Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/Library/WebServer/Documents/quickstart/library:.:/php/includes:/Users/markm
[Sat Dec 08 16:41:39 2012] [error] [client 127.0.0.1]
PHP Fatal error: require_once():
Failed opening required 'Zend/Application.php'
(include_path='/Library/WebServer/Documents/quickstart/library:.:/php/includes:/Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/library')
in /Library/WebServer/Documents/quickstart/public/index.php on line 18
我使用的是MacOSX10.8.2(MountainLion),我在设置和运行Zend框架时遇到了问题(只是基本的快速启动)
我正在使用Apache2.2.22
可以从/Library/WebServer/Documents访问我的本地主机文件
我还运行了PHP5.3.15
我已经通过命令行(使用zf.sh文件)创建了一个名为“快速启动”的新项目(根据Zend网站上的建议),该项目存储在这里:/Library/WebServer/Documents/quickstart
我遵循了Zend官方网站的说明以及关于安装Zend的在线书籍:
我的php.ini(/private/etc/php.ini
)文件已更新,以包含ZendFramework目录中库
文件夹的路径
include_path = ".:/php/includes:/Users/<home>/Dropbox/Library/PHP/ZendFramework-1.12.0/library"
…我还更新了/etc/hosts
,因此它包括
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Ensure "localhost" is preserved unchanged pointed
# to the default document root for our system.
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
</VirtualHost>
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName quickstart.local
DocumentRoot /Library/WebServer/Documents/quickstart/public
SetEnv APPLICATION_ENV "development"
<Directory /Library/WebServer/Documents/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
127.0.0.1 localhost
127.0.0.1 quickstart.local
我正在使用sudoapachectl
重新启动Apache(我还使用了sudoapachectl重新启动
)
因此,如果我现在尝试访问http://localhost/
我看到了我的/Library/WebServer/Documents
目录,我可以看到PHP仍然在运行,没有任何问题。但是如果我尝试访问http://quickstart.local/
我刚刚得到一个空页面
有谁能告诉我问题出在哪里,我遗漏了什么,我能做些什么来显示最初的“欢迎”页面
我肯定我只是错过了一个小人物,但很明显,这会导致基本页面无法显示
谢谢
标记可能是Zend文件和Apache进程之间的用户权限问题 由于可以使用
zf.sh
创建项目,因此Zend文件显然就在那里。但是,通过Apache获得的失败表明,Zend文件可能无法通过Apache进程(即运行Apache进程的用户)访问
$chmod 0777/Users/markmcdonnell/Dropbox/Library/PHP/ZendFramework-1.12.0/Library
测试
您可能会获得更少的扩展权限,例如,
0644
,但我承认我在这方面很糟糕 仅适用于可能遵循此原则的其他人。上面Kamil的答案是可行的,但是在Apache的安全配置之外打开了一个安全漏洞。只要您知道这一点,并且在Apache之上有另一层安全性,就可以了
解决此问题的另一种方法是将ZendFramework放在根目录层次结构中的某个位置。比如:
DocumentRoot/Library/WebServer/Documents/ZendFramework-1.12.0/Library
或
DocumentRoot/Library/WebServer/Documents/quickstart/public/ZendFramework-1.12.0/Library
Apache服务器根目录中的任何路径。您需要更新
php.ini
中的include_path
,以指向ZendFramework
所在的文件夹。我已经这样做了。似乎解决方案是将ZendFramework文件夹放在localhost根目录中!不知道为什么,但ini文件无法遵循Dropbox文件夹的路径?它可以工作,但不是最佳做法。库通常保存在文档根目录之外。。。