I created fresh symfony 2 app which includes AcmeDemoBundle. It works fine.
I commented out in app_dev.php so that it can be accessed from remote server (openshift cloud). On localhost it works without any problem. I git pushed to openshift, and app_dev.php worked as expected.
Then I moved demo routes to route.yml (for production).
On localhost app.php worked without any problem. So I git pushed to openshift but then app.php threw an error:
failed to open stream Acme/DemoBundle/Resources/views/Welcome/index.html.twig
So, I put back demo routes to routes_dev.yml, git pushed, but openshift error persists.
What might be the problem?
EDIT: The problem is that on my localhost path to twig template is "/var/www/html/jba/php/src/JBA/MainBundle/Resources/views/Default/index.html.twig" but on openshift it still looks to the same directory. But openshift dir layout is different, so it can't find the template. I guess I have to configure openshift to look at right directory. Just don't know how.
Have you cleared the cache for the prod environment?
php app/console cache:clear --env=prod
You might also have a look at the server logs/ the sf2 logs within app/logs/prod.log if this won't help.
I issued the following commands before uploading, but somehow cache seems to be not cleared yet.
php /var/www/html/jba/php/app/console cache:clear --env=prod --no-debug
php /var/www/html/jba/php/app/console cache:clear
Only deleting prod and dev directories under app/cache explicitly helped.
See also
Symfony2: access same route in production as development
Related
I have a copy of my Symfony 4 application on my server. When it is in developement mode it works fine.
In my .env file I have dev mode active:
APP_ENV=dev
But now I want my project on the server turn to production mode. So I changed the line to
APP_ENV=prod
But now I see only a blank page. The error log is not updated. What can I do? If I change the line back again to dev, everything works fine...
(I am on a shared host so I am not sure if this is Apache or Nginx)
I think you still have to clear (and if you want) warmup the cache of your new environment. You can do this from the command line:
php bin/console cache:clear
then
php bin/console cache:warmup
I developed my Symfony 2.8 project locally on dev enviroment.
Than i needed to upload it to a server and run it on production.
I did all the steps:
1. Checked it out with git on the server
2. Ran composer install
3. Cleared cache, doctrine cache, installed the assets
4. Configured my database
Saying this ... I`m still getting problems like:
Internel server errors like
No route found for "GET ..
And for some reason it makes requests from time to time to app_dev.php - my ht access clearly states that directory index is app.php and etc
I get double template rendering - the same view is loaded two times - two menu section ... two content section
I am really frustrated, cause ive tried everything i know. Could someone help me, ill provide additional info if needed.
I need any suggestions, ideas and etc that could help me.
My .htaccess file - http://pastebin.com/4XHetMPV
First, try to remove your cache manually and clean your logs :
rm -rf app/cache/* && rm app/logs/prod.log
Then, try to browse a route of your application.
If you still have an error, open your log using cat app/logs/prod.log and find the last error.
If it's a php error caused by a vendor, remove your /vendor directory and run composer update
If you are not able to fix your problem, add to your question the error log and code of the method called by your route that is not working.
As chalasr said, cleaning prod cache manually works after the app.php setup.
I think a command like :
php app/console cache:clear --env=prod --no-debug
should work too.
I developed a project using symfony2/PHP and now I am willing to shift this project to another machine how can I do the same
I tried following
1)I copied project folder to www folder of another machine
2)I edited app\config\parameters.yml on another system
but is not working its giving different erros
Can any one tell me exact staeps
Moving the source and the database should be enough. It is possible, you may have to clean cache.
php app/console cache:clear
Try clearing cache; open console / terminal and type php app/console cache:clear
Try chmod / chown or if you are on a windows machine, try change the owner, check permissions
Try re-run: php composer.phar update
Check your php-version and extensions. (See: http://symfony.com/doc/current/reference/requirements.html)
Cleaning the cache worked for me.
type php app/console cache:clear
I've been developing a Symfony2 app locally and am now at the stage where I would like to deploy it in it's production environment on a server.
I've uploaded all my files and tried to run:
php app/console cache:clear --env=prod
Which gives the following error:
As you can see, it's trying to write to my C:/ drive for some reason. Doing a regular cache:clear works fine, but I can't swap it to the production environment.
At this point, trying to use the app.php version simply loads a blank page. I can't figure out why my app would be trying to write to a directory on a previous server.
Help?
Try empty the cache folder
rm -rf app/cache/*
After this the cache:clear --env=prod command work properly.
My project works just fine in it's dev environment. However, when I attempt to access the prod version that is without the *_dev.php url prefixes, I get redirected to the login page (as it should) and upon logging in it screams a 500 internal server error.
This is true for both the prod site and my dev machine. What's going wrong here?
Clear cache and set permission 777 to prod folder.
Command to clear cache: php bin/console cache:clear
Command to full permission: sudo chmod -R 777 /var/cache/prod
This should work!
I add a 500 error when deploying in production, but I did not get it when in dev environment. Nothing was valuable in the logs, and after trying everythong with permissions and cache, it seems that it was a perfect silent PHP crash.
The issue came from an EasyAdmin AssociationField that was retreiving too many items from the collection. That is why I saw this in prod but not in dev.
After applying a custom QueryBuilder, the error 500 disappeared.
Hope it can help, the difference between prod and dev is often permissions, but it can also be the database.