user4032720
user4032720

Reputation: 91

Symfony 2 : dev to pro = blank page

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.

Upvotes: 6

Views: 7293

Answers (4)

pyjavo
pyjavo

Reputation: 1613

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

Upvotes: 1

Antoine Subit
Antoine Subit

Reputation: 9913

Change your permission on cache and log folders in 777.

chmod 777 cache/ log/ -R
php symfony cc

Upvotes: 1

le0diaz
le0diaz

Reputation: 2508

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

Upvotes: 0

Jovan Perovic
Jovan Perovic

Reputation: 20193

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)

Upvotes: 2

Related Questions