I am trying to setup a new Symfony based website, on an AWS instance. So far I have it pushing to production with Capifony, and that part works fine.
When I try to access the website, I get the following error
Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/myapp/releases/20160813225423/app/cache/prod/annotations" is not writable. in /var/www/myapp/releases/20160813225423/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php:92 Stack trace: #0 /var/www/myapp/releases/20160813225423/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php(37): Doctrine\Common\Cache\FileCache->__construct('/var/www/myapp/re...', '.doctrinecache....', 2) #1 /var/www/myapp/releases/20160813225423/app/cache/prod/appProdProjectContainer.php(1109): Doctrine\Common\Cache\FilesystemCache->__construct('/var/www/myapp/re...') #2 /var/www/myapp/releases/20160813225423/app/bootstrap.php.cache(2222): appProdProjectContainer->getAnnotationReaderService() #3 /var/www/myapp/releases/20160813225423/app/cache/prod/appProdProjectContainer.php(15229): Symfony\Component\DependencyInjection\Container->get('annotation_read...') #4 /var/www/myapp/releases/20160813225423/app/cache/prod/appProdProjectContainer.php(15220): appProdProjectContainer- in /var/www/myapp/releases/20160813225423/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php on line 92
I then fix up the permissions of the directory to 777 (this happens for a couple of directories inside cache...not sure if I am doing it right...
The cache is rebuilt each push to production, as the folder is not shared.
After fixing those errors I get a new error
"Oops! An Error Occurred
The server returned a "404 Not Found".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused."
So now the server states there is a 404 error. I can assume that my nginx config is ok, and the php70w-fpm is working fine. Yes I am using PHP7.
I would love some advice on what I am doing wrong, and a guide or direction towards the solution. I don't expect the solution handed to me on a silver platter.
Thanks everyone for your help in advance.
So after looking into the issue I found the problem.
The initial problem of
Fatal error: Uncaught InvalidArgumentException: was caused by the folder permissions at changing them to
777 did infact fix that issue.
The next issue that occurred
The server returned a "404 Not Found" I found was caused by a missing piece of data in the database. To find this out in the production environment I edited the
app.php on the line
$kernel = new AppKernel('prod', false); to contain true not false, thus forcing development error reporting to appear rather than 404 errors.
In the end the nginx configurations were perfect.