在 cPanel 中部署 Zend Framework 时出现内部服务器错误

发布于 2024-12-04 04:21:53 字数 2088 浏览 1 评论 0原文

我刚刚在托管服务中部署了我的 Zend 项目。我将项目作为存档上传,然后提取到 public_html 文件夹中。所以我有这个目录:

public_hmtl
->应用程序(文件夹)
->库(文件夹)
->公共(文件夹)
->测试(文件夹)
->cgi-bin(文件夹)(这本来就不属于我)
->构建路径
->htaccess(这本来就不属于我)
->项目
->zfproject.xml
->index.php(用于重定向到/public)

当我运行该网站时,它显示:

内部服务器错误

服务器遇到内部错误或配置错误, 无法完成您的请求。

请联系服务器管理员,[电子邮件受保护] 并 告知他们错误发生的时间以及您可能会发生的任何事情 所做的事情可能导致了错误。

有关此错误的更多信息可能会在服务器错误中提供 日志。

此外,尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误。

我使用 xampp 在 localhost 中完成了该项目,并且工作正常。但是当我在cPanel中上传时,就变成了这样。

我已将文件夹的 chmod 设置为 755,将文件设置为 644。我认为这与 htaccess 有关,但我不太明白如何在 cPanel 中处理它。

我应该怎么办?

错误日志显示如下:

[Sat Sep 10 15:10:39 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/404.shtml
[Sat Sep 10 15:10:39 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/favicon.ico
[Sat Sep 10 15:10:39 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/500.shtml
[Sat Sep 10 15:10:39 2011] [alert] [client 125.163.228.77] /home/publicusername/public_html/public/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
[Sat Sep 10 15:09:58 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/404.shtml

我的 public/htaccess

SetEnv APPLICATION_ENV production

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

我已将 public/htaccess 中的 SetEnv APPLICATION_ENV 设置为 SetEnv APPLICATION_ENV Production,但仍然失败。

I just deployed my Zend project in a hosting service. I upload my project as archive then extracted in public_html folder. so I have this directory:

public_hmtl
->application (folder)
->libary (folder)
->public (folder)
->test (folder)
->cgi-bin (folder) (this not belong to me in the first place)
->buildpath
->htaccess (this not belong to me in the first place)
->project
->zfproject.xml
->index.php (this is for redirecting to /public)

When I run the site, it shows :

Internal Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.

Please contact the server administrator, [email protected] and
inform them of the time the error occurred, and anything you might
have done that may have caused the error.

More information about this error may be available in the server error
log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I did the project in localhost using xampp and it works fine. But when I uploaded in cPanel, it became like that.

I have set the chmod for folder to 755 and file to 644. I think it has to do with the htaccess but I don't quite understand how to deal with that in cPanel.

What should I do?

The error log shows something like this:

[Sat Sep 10 15:10:39 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/404.shtml
[Sat Sep 10 15:10:39 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/favicon.ico
[Sat Sep 10 15:10:39 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/500.shtml
[Sat Sep 10 15:10:39 2011] [alert] [client 125.163.228.77] /home/publicusername/public_html/public/.htaccess: Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration
[Sat Sep 10 15:09:58 2011] [error] [client 125.163.228.77] File does not exist: /home/publicusername/public_html/404.shtml

my public/htaccess

SetEnv APPLICATION_ENV production

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

I have set the SetEnv APPLICATION_ENV to SetEnv APPLICATION_ENV production in public/htaccess, but still failed.

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

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

发布评论

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

评论(2

↘紸啶 2024-12-11 04:21:53

该错误似乎指向 SetEnv。我最好的猜测是您的主机正在使用非常的 Apache 版本(1.3.7 之前的版本)或者尚未启用 mod_env

The error seems to point to SetEnv. My best guess is your host is using a really old version of Apache (pre 1.3.7) or has not enabled mod_env.

与之呼应 2024-12-11 04:21:53

我认为你的错误是文件夹结构不正确。文件夹“public_html”不应包含所有项目树,此处应仅包含“public”文件夹内容。其他文件夹(应用程序、库、测试等)应位于“public_html”文件夹之外。 “Public_html”是您的网络根目录。您可以将“public_html”想象为“public”文件夹的别名。

我在当前项目中使用的文件夹结构(服务器位于 CentOS 上,使用 CPanel)。如果源中使用名称“public”,您可能会遇到问题。在这种情况下,您可以在主“index.php”文件中定义别名并在其他地方使用它。

I think your error is not right folder structure. Folder 'public_html' should not contain all project tree, here should be only 'public' folder contents. Other folders (application, library, test etc.) should be outside 'public_html' folder. 'Public_html' is your web-root directory. You may imagine 'public_html' as alias of your 'public' folder.

That folders structure I use in my current project (Server is on CentOS and CPanel is used). May be you will have a problem if name 'public' is used in source. In this case you might to define alias in the main 'index.php' file and use it in other places.

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