Ever happened to you, that your symfony project works in the production stage and in the moment that you decide to deploy in your server , the history is another?.
You're stuck and do not know how to solve the problem ? Here you will find some tips that my help you to get out of this problem.
1) Check the config.php of your project
The most basic action is try to access the config.php
file , you can reach it following the url
yourdomain.com/config.php
If your server targets the correct path to your project (which usually is server-path/vhosts/mydomain/web/
) notice that must target the web path of the project the following alert should appear in your browser.
This script is only accessible from localhost
, this error is due to the following script (remember that you can add your ip to the array).
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
'you can add your ip here to allow the remote debugging to only your ip',
))) {
header('HTTP/1.0 403 Forbidden');
die('This script is only accessible from localhost.');
}
If the previous alert or the Symfony configuration screen didn't appear check that your server targets the correct folder of your project !
Most of the main problems will be listed in the symfony wizard.
You can solve some of the previous problems with these solutions
2) Give writing permissions to all the required folders
Remember to give 777
(not recommended, but you need to check if everything works properly first, then you'll have time to check what permissions you really need) permissions to the following folders :
/app/cache
/app/logs
<dont forget you upload file path too>
3) Check that your credentials matches with the given in the database in your parameters.yml if you use one
Forget to change the user and the password in production is a common mistake, checkout your parameters.yml file and verify that your credentials are correct
# app/config/parameters.yml
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: ~
database_name: ourcodeworld
database_user: ourcodeworlduser
database_password: ourcodeworldpassword
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
4) Check your PHP Server version
According to the official requirements of Symfony2.
- PHP needs to be a minimum version of PHP 5.3.9.
- JSON needs to be enabled.
- ctype needs to be enabled.
- Your php.ini needs to have the date.timezone setting.
- Be aware that Symfony has some known limitations when using PHP 5.3.16. For more information see the Requirements section of the README.
- If your server doesn't accomplish with those requirements you will be unable to run a symfony2 project.
Have fun