Symfony 2 : dev to pro = blank page
Asked Answered
O

4

6

first I took you to excuse my English. I made a website with Symfony which works fine locally. (dev and prod). But as soon as I put online the dev version works but the prod version displays a blank page. Lighttpd does not give me error. PHP does not give me error. Cache and log are writable.

I do not understand anything.

Otilia answered 26/3, 2014 at 22:43 Comment(6)
Can you check HTTP response (in Chrome Developer Toolbar) when you get a blank page?Rosebay
Seems like you just have to clear your cache php app/console cache:clear --env=prod or just remove everything manually in the app/cache/ folder.Triboelectricity
500 Internal Server Error T_TOtilia
Seems like you just have to clear your cache php app/console cache:clear --env=prod or just remove everything manually in the app/cache/ folder -> nothing changeOtilia
Does your web server have permissions to write to the cache folders on the production server? symfony.com/doc/current/book/…Mil
Yes log and cache have permissions. ls -l linkOtilia
C
2

OK, this is highly undesirable situation as you need to squash bugs one-by-one. It could be as benign as missing php module or some major httpd misconfiguraion.

Some steps that should shed some light on the issue:

  1. Fire up the Terminal (you do have ssh access, right?)
  2. Check logs (both httpd and symfony)

httpd log:

tail -f /var/log/httpd/error_log

... and refresh your page

Symfony

tail -f /path-to-your-symfony-app/app/logs/prod.log

... again, refresh your page

In your comment, you said you encountered HTTP500 error. Is that Apache's or Symfony's HTTP500?

If you do not hape ssh access upload your app_dev.php and run it directly. Be sure to add your IP address to list of allowed (within the file)

Clinker answered 26/3, 2014 at 23:12 Comment(3)
I use ssh access. I looked at the log file lighttpd and nothing changes when I reload the page. I do not have a dev.log but just a prod.log for symfony.Otilia
And how about access_log of your lighttpd? Sorry, I'm a bit unfamiliar about log names in lighttp...Clinker
My log in prod : log file and my log in dev : log fileOtilia
F
1

Change your permission on cache and log folders in 777.

chmod 777 cache/ log/ -R
php symfony cc
Fidgety answered 12/1, 2015 at 15:43 Comment(1)
It was just chmodding app/cache/ and app/logs/ for meMounts
K
1

As the documentation says:

Instead of the Welcome Page, you may see a blank page or an error page. This is caused by a directory permission misconfiguration. There are several possible solutions depending on your operating system. All of them are explained in the Setting up Permissions section.

And then you should follow these steps:

  1. rm -rf app/cache/*
  2. rm -rf app/logs/*
  3. HTTPDUSER=' ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1'
  4. sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:'whoami':rwX app/cache app/logs
  5. sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:'whoami':rwX app/cache app/logs
Kathaleenkatharevusa answered 1/9, 2015 at 15:14 Comment(0)
B
0

I did the deployment as guided in this official docs

In my case the update of symfony before deploying was not BC with an old Bundle, so the clear:cache --env=prod was giving some error. So what I did was to manually delete the prod cache and then clear:cache with the prod environment and it worked: so to resume:

#rm -rf app/cache/prod/*  #removes only production cache
rm -rf app/cache/   #removes prod and any other stage cache
php app/console cache:clear --env=prod
Brewery answered 16/10, 2014 at 20:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.