【问题标题】:Error 500 after deploying a symfony app部署 symfony 应用程序后出现错误 500
【发布时间】:2010-03-11 07:21:34
【问题描述】:

我已经使用“project:deploy --go”部署了我的项目。现在我在“public_html”中有我的文件夹“apps”、“lib”、“web”等。当我尝试登录我的网络应用程序的用户会话时,我收到错误 500。

这是我在 php 错误日志中发现的:

[2010 年 3 月 9 日星期二 05:47:02] [错误] [客户端 174.37.227.194] 客户端被拒绝 按服务器配置: /home/mainhost/public_html/whm-server-status

[2010 年 3 月 9 日星期二 05:47:02] [错误] [客户端 174.37.227.194] 文件没有 存在: /home/mainhost/public_html/403.shtml

我有一个共享服务器,所以我无法修改 .httpd.conf。

这是我的 web/.htaccess 文件:

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule

这是 ProjectConfiguration.class.php:

<?php

# FROZEN_SF_LIB_DIR: /opt/lampp/htdocs/rs/lib/vendor/symfony/lib

require_once dirname(__FILE__).'/../lib/symfony/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    // for compatibility / remove and enable only the plugins you want
    $this->enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin'));

    $this->setWebDir($this->getRootDir().'/public_html/web');


  }
}

我使用自己的 rsync/ssh 命令时没有任何问题。

更多新闻:

当我收到 500 错误时,下面的这一行也写在 web/error_log 中:

[10-Mar-2010 14:37:57] PDO 连接 错误:SQLSTATE[HY000] [2002] 不能 通过连接到本地 MySQL 服务器 插座 '/opt/lampp/var/mysql/mysql.sock' (2)

即使我已经在 databases.yml 中写了这个:

开发者:

测试:

all:
   doctrine:
     class: sfDoctrineDatabase
     param:
       dsn: mysql:host=localhost;dbname=tirengar_rs
       username: tirengar
       password: mypassword

有什么想法吗?

贾维

【问题讨论】:

  • 部署后是否尝试在远程调用symfony project:permissions
  • 几乎可以肯定是权限问题。 “php 错误日志”中的错误与您服务器上的 cPanel 软件有关,而不是 symfony。检查 symfony 日志/frontend_prod.log 文件是否有任何 500 错误或 Apache error.log。那里会报“PHP Fatal error”。

标签: symfony1 deployment


【解决方案1】:

首先必须将 httpd.conf 文件更改为引用 /sites/dir/website/web 目录作为 DocumentRoot 目录,所有其他文件(例如 lib 和 config)不得通过网络访问。

通过使用 frontend_dev.php 加载站点(从您的计算机复制并添加您的 IP 地址)来查看服务器遇到的确切问题。

另一个可能的问题是您的网络应用无法访问数据库。

【讨论】:

  • 谢谢!是的,这是真的,我在本地有我的“web”目录在 /opt/lammp/htdocs/rs/web 中。在你回答之前,我的路径是 /public_html/web,现在是 /public_html/rs/web。
猜你喜欢
  • 1970-01-01
  • 2021-12-04
  • 1970-01-01
  • 1970-01-01
  • 2020-08-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多