2
votes

I have a working Symfony2 application running on my local server that I want to upload to my shared hosting. When I try to open the website on my shared hosting I get a 500 response.

I perform these steps:

  1. Clear the cache ("php app/console cache:clear" and "php app/console cache:clear --env=prod")
  2. Upload /app, /src, /vendor, /web to shared hosting
  3. Make /logs and /cache writable (and all subfolders/files)

When I open "www.mydomain.com/app.php" I'm getting a 500 response. When I open "www.mydomain.com/app_dev.php" Symfony gives (the expected and correct) message that I'm not allowed to open this file.

The /logs/prod.log is empty.

It's not possible for me to clear the cache on the shared hosting server because I don't have SHH access. I can only clear the cache on my local server and then upload the files.

I didn't change my /web/.htaccess file, this is in it:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
1
Try to remove the lines preventing you to access config.php from outside to see if your configuration is ok. DO NOT FORGET to remove/restore the file once you are done. - cheesemacfly
I'm getting the Welcome page. Only some "Recommendations" are given: install intl, install accelerator, Set short_open_tag to off. - BigJ
And if you do the same with app_dev.php and call it? - cheesemacfly
I get the 500 response, but this time with the message: file_get_contents(F:\wamp\www\MySite\vendor\symfony\symfony\src\Symfony\Bundle\WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig): failed to open stream: No such file or directory in mydomain.com/mm/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 126. So it tries to load the file from my F: drive, which of course fails. - BigJ
What if you clear you app/cache folder manually (rm -rf app/cache/*) and try again? - cheesemacfly

1 Answers

3
votes

The problem seemed to be the command php app/console cache:clear" and "php app/console cache:clear --env=prod didn't completely clear the cache folder.

It can happen if the user running the command hasn't the permission to delete files/folder in app/cache/ Manually removing the content of this folder can solve the issue (rm -rf app/cache/*).