第一次用zend framework遇到的一些问题

1、出现错误 Zend_Controller_Dispatcher_Exception: Invalid controller specified (error) in Standard.php on line 242
此时是应用程序出错,zend framework在默认情况下将错误指向error controller,而此时却没有创建此contraller,所以会出现此问题。
解决方案是在controller下面建立ErrorController.php 加errorAction事件;并在views/scripts建立文件夹error,建立error.phtml文件

2、在apache中使用别名浏览zend framework创建的项目时,可能存在路由不通的情况,
即文件夹的名字要与路径名字对应,如果你是http://localhost/zf/public/customers
这样的访问路径,则项目根目录应该是zf,index.php所在的目录是public

3、.htaccess文件无法生效,可能存在的问题:
apache的mod_rewrite没有开启,
或者.htaccess文件语法错误,比如说在[NC,L]这种格式中加一个空格,出现错误的单词;不过此种情况下会报错:Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
或者,在apache的配置中 Options 没有设置为FollowSymLinks, AllowOverride 没有设置成All
或者,在apache的错误日志中显示 Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration
这个是没有开启mod_rewrite模块,加载rewrite模块,在httpd.conf文件里最后加上如下代码:
LoadModule rewrite_module modules/mod_rewrite.so
或者原本配置文件中的就有这行代码,只不过是注释了,也可以直接去掉LoadModule rewrite_module modules/mod_rewrite.so前的注释“#”

这些都是有可能出问题的。

4、权限问题
将zend framework的library放在没有权限的目录,比如说放在php.ini中的open_basedir以外的地方等等

5、出现404错误
可能是apache的DocumentRoot设置问题(如果是使用别名调试)

第一次用zend framework遇到的一些问题》上有1条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注


*

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>