部署symfony应用程序后出现错误500 [英] Error 500 after deploying a symfony app
问题描述
这是我在php错误日志中创建的: p>
[Tue Mar 09 05:47:02 2010] [错误]
[客户端174.37.227.194]客户端被拒绝
按服务器配置:
/ home / mainhost / public_html / whm-server-status
[Tue Mar 09 05:47:02 2010] [error]
[客户端174.37.227.194]文件不
存在:
/home/mainhost/public_html/403.shtml
我有一个共享服务器,所以我无法修改.httpd.conf。
这是我的web / .htaccess文件:
选项+ FollowSymLinks + ExecCGI
< IfModule mod_rewrite.c>
RewriteEngine On
#取消注释以下行,如果您遇到麻烦
#获取no_script_name工作
#RewriteBase /
#我们用.something
跳过所有文件#RewriteCond%{REQUEST_URI} \ .. + $
#RewriteCond%{REQUEST_URI}!\.html $
#RewriteRule。* - [L ]
#我们检查.html版本是否在这里(缓存)
RewriteRule ^ $ index.html [QSA]
RewriteRule ^([^。] +)$ $ 1 .html [QSA]
RewriteCond%{REQUEST_FILENAME}!-f
#不,所以我们重定向到我们的前台Web控制器
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()
{
//兼容性/删除,只启用你想要的插件
$ this-> enableAllPluginsExcept(array('sfPropelPlugin','sfCompat10Plugin'));
$ this-> setWebDir($ this-> getRootDir()。'/ public_html / web');
}
}
我没有任何问题,当我使用我自己的rsync / ssh命令。
更多新闻:
当我得到那500以下这行错误也写在web / error_log中:
[2010年3月10日14:37:57] PDO连接
错误:SQLSTATE [HY000] [2002]不能
通过
连接到本地MySQL服务器
'/opt/lampp/var/mysql/mysql.sock'(2)
即使我在databases.yml中写过:
dev :
test:
all:
doctrine:
class:sfDoctrineDatabase
param:
dsn:mysql:host = localhost; dbname = tirengar_rs
用户名:tirengar
密码:mypassword
任何想法?
Javi
首先,httpd.conf文件必须更改作为DocumentRoot目录引用/ sites / dir / website / web目录,所有其他文件(如lib和config)不能通过网络访问。
使用frontend_dev.php加载网站(从您的计算机复制并添加您的IP地址)服务器遇到的问题。
另一个可能的问题是您的网络应用程序不能访问数据库。
I have deploy my project using "project:deploy --go". Now i have my folders "apps", "lib", "web", etc, inside "public_html". When i try to login to a user session of my web app, i get an error 500.
This is what i'm founding in the php error log:
[Tue Mar 09 05:47:02 2010] [error] [client 174.37.227.194] client denied by server configuration: /home/mainhost/public_html/whm-server-status
[Tue Mar 09 05:47:02 2010] [error] [client 174.37.227.194] File does not exist: /home/mainhost/public_html/403.shtml
I have a shared server so i can not modify .httpd.conf.
This is my web/.htaccess file:
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
And this is 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');
}
}
I dont have any problem when i use my own rsync/ssh command.
More news:
when i get that 500 error this line below is written also in web/error_log:
[10-Mar-2010 14:37:57] PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)
Even if i have written this in databases.yml:
dev:
test:
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: mysql:host=localhost;dbname=tirengar_rs
username: tirengar
password: mypassword
Any idea?
Javi
First the httpd.conf file MUST be changed to reference /sites/dir/website/web directory as the DocumentRoot directory, all other files such as lib and config must not be accessible over the web.
See the exact problem the server is having by using frontend_dev.php to load the site (copy from your computer and add your IP address).
Another likely issue is that your web app cannot access the database.
这篇关于部署symfony应用程序后出现错误500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!