Zend AutoLoader 在共享主机下无法正常运行
我最近在共享主机上启动了一个 zend 框架项目。经过一番努力,我让第一个索引页工作了,但是没有找到所有可自动加载的类,如模型、表单、映射器。
这是我在根文件夹的公共目录之外使用的 .htaccess 版本。
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
一个有点令人惊讶的事实是,在首页或基本 URL 中可以识别相同的映射器和表单,但超过它,就没有任何效果。
我做错了什么或错过了什么?
I recently lauched a zend framework project on a shared hosting. With much struggle, I got the first index page working, but pass it all the autoloadable classes like models, forms, mappers are not found.
Here is the version of .htaccess i am using outside the public directory on the root folder.
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
A bit surprising fact is that same mappers and forms are recognised in the front page, or the baseURL, but surpass it, nothing is working.
What am i doing wrong or missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为如果您从 Zend Framework“public”文件夹中复制
index.php
和.htaccess
并将其放入您的public_html
或等效目录中。如果您的 Zend Framework 应用程序目录与 public_html 位于同一目录中,则默认的 .htaccess 文件和 index.php 文件应该可以工作。I think if you copy
index.php
and.htaccess
from the Zend Framework "public" folder and put it in yourpublic_html
or equivalent directory. If your Zend Framework application directory is in the same directory as public_html then the default .htaccess file and index.php file should work.使用此替代
基本思想是,如果服务器上存在请求的 url 的文件,则将其发送到客户端浏览器,否则将请求转发到 ZF 应用程序来处理它。
要使您的公共目录在根域下可访问,请编辑 Apache httpd.conf 文件。直接将您的虚拟主机映射到公共目录。
Use this instead
Basic idea is if a file exist for requested url on server then send it to the client browser otherwise forward the request to ZF application to deal with it.
To make your public dir accessible under root domain edit Apache httpd.conf file instead . Map your virtual host to public dir directly .
您可以尝试我寻找并应用的解决方案吗?这对我有用。
http://blog.motane.lu/ 2009/11/24/zend-framework-and-web-hosting-services/
您填写 /public_html/.htaccess 的所有内容(不是/public_html/public/.htaccess)通过
Can you try the solution that i looked for and apply. It's worked for me.
http://blog.motane.lu/2009/11/24/zend-framework-and-web-hosting-services/
You fill all content of /public_html/.htaccess (not /public_html/public/.htaccess) by