Search code examples
phpsymfonydeploying

Symfony 2 server deploy Fatal Error: It tries to open localhost file


I've made a symfony2 app and I try to deploy it on a shared server, but I get a fatal error.

I've taken the recommended steps here: Deployment-Tools

I've updated the vendor dependencies:

php composer.phar install --optimize-autoloader

I've cleared the cache:

php app/console cache:clear --env=prod --no-debug

I've change the permissions on the server for app/cache and app/logs

But it doesn't work. This is the error:

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/cookieboy/app/logs/prod.log" could not be opened: failed to open stream: No such file or directory' in /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:71

Stack trace:

#0 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)

#1 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php(58): Monolog\Handler\AbstractProcessingHandler->handle(Array)

#2 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php(101): Monolog\Handler\AbstractHandler->handleBatch(Array)

#3 /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Logger.php(239): Monolog\Handler\FingersCrossedHandler->handle(Array)

#4 /homepages/32/d453730371/htdocs/cookieboy/vendor/mo in /homepages/32/d453730371/htdocs/cookieboy/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 71

and I was wondering why symfony tries to open this file /var/www/cookieboy/app/logs/prod.log) which is located at locahost and It has nothing to do with the production server.

Any idea about that issue?


Solution

  • I have solved the issue by deleting manually all the content inside app/cache. I don't know why but the command php app/console cache:clear --env=prod --no-debug didn't make its job in the way I was expecting.

    Thank you all for the answers.