[英]Deploying a Symfony2 project
We were working on a Symfony2 project. 我们正在开发一个Symfony2项目。 Now, it's done and ready to be deployed.
现在,它已经完成并准备好部署。 We uploaded the whole project files to the server (via ftp of course) and the database as well.
我们将整个项目文件上传到服务器(当然是通过ftp)和数据库。 Now when we open any page of it we got just a blank page (empty source code).
现在,当我们打开它的任何页面时,我们只得到一个空白页面(空源代码)。 Cache is clean, logs do not show anything new.
缓存很干净,日志不会显示任何新内容。 We googled the steps of deploying a Symfony2 project to a hosting but we did not find a good explanation (even these ones were about Symfony not-version-2).
我们搜索了将Symfony2项目部署到托管的步骤,但我们没有找到一个很好的解释(即使这些是关于Symfony not-version-2)。 We believe it maybe a configuration issue, but no idea so far.
我们认为它可能是一个配置问题,但到目前为止还不清楚。 Any help will be greatly appreciated.
任何帮助将不胜感激。 Thanks in advance.
提前致谢。
Edit: the blank page is in Firefox. 编辑:空白页面在Firefox中。 Google Chrome is saying something:
Google Chrome正在说些什么:
Server error The website encountered an error while retrieving http:// * .com/mammoky/web/app_dev.php/main.
服务器错误网站在检索http:// * .com / mammoky / web / app_dev.php / main时遇到错误。 It may be down for maintenance or configured incorrectly.
它可能已关闭以进行维护或配置不正确。 Here are some suggestions: Reload this webpage later.
以下是一些建议:稍后重新加载此网页。 HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
HTTP错误500(内部服务器错误):服务器尝试完成请求时遇到意外情况。
error_log is showing: error_log显示:
[24-Mar-2012 23:29:24] PHP Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /home/leadow33/public_html/mammoky/web/app.php on line 7
[2012年3月24日23:29:24] PHP解析错误:语法错误,意外T_STRING,期待T_CONSTANT_ENCAPSED_STRING或'('在/home/leadow33/public_html/mammoky/web/app.php第7行
It's: use Symfony\\Component\\HttpFoundation\\Request; 它是:使用Symfony \\ Component \\ HttpFoundation \\ Request; And
和
[24-Mar-2012 23:15:08] PHP Warning: Unexpected character in input: '\\' (ASCII=92) state=1 in /home/leadow33/public_html/mammoky/web/config.php on line 84
[24-Mar-2012 23:15:08] PHP警告:输入中出现意外字符:第84行/home/leadow33/public_html/mammoky/web/config.php中的'\\'(ASCII = 92)状态= 1
It's: $reflector = new \\ReflectionExtension('intl'); 它是:$ reflector = new \\ ReflectionExtension('intl');
EDIT: I've posted my solution, check it out down here. 编辑:我已经发布了我的解决方案,请在此处查看。
Answer: 回答:
I got it to work, this is my experience: 我得到了它的工作,这是我的经验:
www.your-website.com/project-name/web/config.php
. www.your-website.com/project-name/web/config.php
。 config.php
: config.php
: if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1', /*your IP here*/))) {
header('HTTP/1.0 403 Forbidden');
die('This script is only accessible from localhost.');
}
config.php
file, the page will tell you if your system is missing some required conditions like: PHP version, APC extension, giving /cache and /log folders permissions to write on, etc. config.php
文件,该页面将告诉您系统是否缺少某些必需条件,例如:PHP版本,APC扩展名,给予/缓存和/ log文件夹写入权限等。 www.your-website.com/project-name/web/app_dev.php
, it'll help you get started with Symfony2 project. www.your-website.com/project-name/web/app_dev.php
,它将帮助您开始使用Symfony2项目。 app_dev.php
this message: You are not allowed to access this file...
just do the same thing to app_dev.php
as you did in steps 4 and 5 (add your public IP address to the array). app_dev.php
中app_dev.php
此消息: You are not allowed to access this file...
只需对app_dev.php
执行与执行步骤4和步骤5相同的操作(将您的公共IP地址添加到阵列中)。 app_dev.php
and comment out the line die('You are not allowed to..
, however this is not a recommended way because you're disabling the built-in security of the file. app_dev.php
并注释掉行die('You are not allowed to..
,但这不是推荐的方式,因为你禁用了文件的内置安全性。 Index.html.php
for example) does not exist, however it does exist, but I did return $this->render('...:index.html.php')
with small i
in DefaultController.php
. Index.html.php
)没有存在,但确实存在,但我确实在DefaultController.php
使用小i
return $this->render('...:index.html.php')
。 So render the exact template (file) name with the same letters cases. Now everything is going well, I hope that helps you. 现在一切顺利,我希望能帮到你。
In my case it was the php version* and I catched the error by running config.php with removed lines for checking ip address. 在我的情况下,它是PHP版本*,我通过运行config.php与删除行检查IP地址捕获错误。 On my hosting I just changed the default version of PHP for my scripts.
在我的托管上,我刚刚为我的脚本更改了PHP的默认版本。
*Since namespaces are only from 5.3. *由于名称空间仅来自5.3。
If your installation runs on a shared webserver, try setting the following line into the app.php: 如果您的安装在共享的Web服务器上运行,请尝试将以下行设置为app.php:
date_default_timezone_set('America/Los_Angeles');
This solves the problem in my case. 这解决了我的问题。
production isnt app_dev but app.. The page might be the same did you do a view source? 生产不是app_dev但应用..页面可能与您查看源视图相同? Did you try to run the config.php that comes with the framework zip ?
您是否尝试运行框架zip附带的config.php?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.