如何将 Zend Framework 从开发转移到生产?

发布于 2024-09-03 14:45:01 字数 503 浏览 6 评论 0原文

我只是想知道是否有其他人在将 Zend Framework 从开发转移到生产时遇到问题。

我将文档根目录更改为公共文件夹,更新了我的库路径,但它仍然不适合我。 IndexController 工作正常,但我的 ServiceController 给我一个内部服务器错误。

服务控制器

<?php

class ServiceController extends Zend_Controller_Action
{
  public function amfAction()
  {
   require_once APPLICATION_PATH . '/models/MyClass.php';
   $srv = new Zend_Amf_Server();
   $srv->setClass('Model_MyClass', 'MyClass');
   echo $srv->handle();
   exit;
  }
}

I'm just wondering if anyone else has had problems moving the Zend Framework from development to production.

I changed my docroot to the public folder, updated my library path, but it's still not working out for me. The IndexController is working just fine, but my ServiceController is giving me an internal server error.

ServiceController

<?php

class ServiceController extends Zend_Controller_Action
{
  public function amfAction()
  {
   require_once APPLICATION_PATH . '/models/MyClass.php';
   $srv = new Zend_Amf_Server();
   $srv->setClass('Model_MyClass', 'MyClass');
   echo $srv->handle();
   exit;
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

浅忆 2024-09-10 14:45:01

尝试回显 APPLICATION_PATH 以查看路径是否正确。另外,请注释掉与在模型中实例化 Zend 相关的所有代码(在执行包含操作之后),并查看是否出现错误。

另外,尝试使用您的 .htaccess 文件进行试验。您可能只是遇到了一些与您的托管提供商不兼容的问题。

Try echoing APPLICATION_PATH to see if you have the correct path. Also, ry commenting out all the code pertaining to instantiating Zend in your model, (after you do the include), and see if the error comes up.

Also, try experimenting with your .htaccess file. you may just have something wrong going on there that doesn't jive with your hosting provider.

可是我不能没有你 2024-09-10 14:45:01

感谢杰森今天的帮助。实际上,我通过将 .htaccess 文件从默认值调整为其他内容来使其正常工作。显然ZF在1and1方面表现不佳。这就是我为使其正常工作所做的:

AddType x-mapp-php5 .php

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>

Thanks for your help today Jason. I actually got it working by adjusting my .htaccess file from the default to something else. Apparently ZF doesn't play nicely with 1and1. This is what I did to get it working:

AddType x-mapp-php5 .php

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文