Zend AutoLoader 在共享主机下无法正常运行

发布于 2024-12-07 22:29:13 字数 535 浏览 1 评论 0原文

我最近在共享主机上启动了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

还在原地等你 2024-12-14 22:29:13

我认为如果您从 Zend Framework“public”文件夹中复制 index.php.htaccess 并将其放入您的 public_html 或等效目录中。如果您的 Zend Framework 应用程序目录与 public_html 位于同一目录中,则默认的 .htaccess 文件和 index.php 文件应该可以工作。

/home/yoursite
--application/
---- controllers
---- forms/
---- models/
---- views/
-- library/
-- public_html/ (public)
---- .htaccess
---- index.php

I think if you copy index.php and .htaccess from the Zend Framework "public" folder and put it in your public_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.

/home/yoursite
--application/
---- controllers
---- forms/
---- models/
---- views/
-- library/
-- public_html/ (public)
---- .htaccess
---- index.php
ぺ禁宫浮华殁 2024-12-14 22:29:13

使用此替代

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

基本思想是,如果服务器上存在请求的 url 的文件,则将其发送到客户端浏览器,否则将请求转发到 ZF 应用程序来处理它。

要使您的公共目录在根域下可访问,请编辑 Apache httpd.conf 文件。直接将您的虚拟主机映射到公共目录。

Use this instead

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

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 .

清眉祭 2024-12-14 22:29:13

您可以尝试我寻找并应用的解决方案吗?这对我有用。
http://blog.motane.lu/ 2009/11/24/zend-framework-and-web-hosting-services/

您填写 /public_html/.htaccess 的所有内容(不是/public_html/public/.htaccess)通过

RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]

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

RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文