We were working on a Symfony2 project. 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. 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). 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. Google Chrome is saying something:
Server error The website encountered an error while retrieving 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.
error_log is showing:
[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
It's: use 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
It's: $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
.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.www.your-website.com/project-name/web/app_dev.php
, it'll help you get started with Symfony2 project.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
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. 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
. 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. On my hosting I just changed the default version of PHP for my scripts.
*Since namespaces are only from 5.3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With