I have just deployed my application on the server. If I use APP_ENV=dev, everything works fine but if I use APP_ENV=prod, I get the following error:
Fatal error: Uncaught Twig\Error\LoaderError: The
"/home/httpd/vhosts/example.com/httpdocs/api_tapalle\vendor\symfony\framework-bundle/Resources/views"
directory does not exist
("/home/httpd/vhosts/example.com/httpdocs/api_tapalle\vendor\symfony\framework-bundle/Resources/views").
in
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/vendor/twig/twig/src/Loader/FilesystemLoader.php:106
Stack trace: #0
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/var/cache/prod/ContainerTP5linE/srcApp_KernelProdContainer.php(471):
Twig\Loader\FilesystemLoader->addPath('/home/httpd/vho...',
'Framework') #1
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/var/cache/prod/ContainerTP5linE/srcApp_KernelProdContainer.php(729):
ContainerTP5linE\srcApp_KernelProdContainer->getTwigService() #2
/home/httpd/vhosts/example.com/httpdocs/api_tapalle/var/cache/prod/ContainerTP5linE/srcApp_KernelProdContainer.php(346):
ContainerTP5linE\srcApp_KernelProdContainer->getSensioFrameworkExtra_View_ListenerService() #3 /home/httpd/vhosts/y in /home/httpd/vhosts/example.com/httpdocs/api_tapalle/vendor/twig/twig/src/Loader/FilesystemLoader.php
on line 106
Since I have this error, I have used php bin/console cache:clear -e prod to clear the cache and then uploaded var and vendor directories again.
The weird thing is that vendor\symfony\framework-bundle/Resources/views and vendor/twig/twig/src/Loader/FilesystemLoader.php exist on the server!
Why do I get this error?
updlas the project with all the cache production, dont make a cache clear
Related
When I try do deploy my website on the server I have this error :
Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to write in the cache directory (/home/e120223/public_html/ReclyZone/app/cache/prod) ' in /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:597 Stack trace: #0 /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(510): Symfony\Component\HttpKernel\Kernel->buildContainer() #1 /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(133): Symfony\Component\HttpKernel\Kernel->initializeContainer() #2 /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(182): Symfony\Component\HttpKernel\Kernel->boot() #3 /home/e120223/public_html/ReclyZone/web/app.php(16): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #4 {main} thrown in /home/e120223/public_html/ReclyZone/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php on line 597
I have already clear cache but nothing works, do you have an idea ?
chmod -R 777on the cache directory to give permission to read AND write
The problem is that you don't have permission to write in that cache directory.
I would change the default cache directory to a writable folder.
See the official documentation http://symfony.com/doc/current/configuration/override_dir_structure.html#override-cache-dir
I am very new to Symfony. I have installed Symfony in my system with symfony demo command it's working fine. I installed in that folder already developed project code. when use php bin/console server:start 0.0.0.0:8000 this command I am getting error:
PHP Fatal error: Uncaught RuntimeException: The autoloader expected class "AppKernel" to be defined in file "/home/Desktop/commercetools-sunrise-php-master/vendor/composer/../../app/AppKernel.php". The file was found but the class was not in it, the class name or namespace probably has a typo. in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:223
Stack trace:#0 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('AppKernel')#1 /home/Desktop/commercetools-sunrise-php-master/bin/console(26): spl_autoload_call('AppKernel')#2 {main}
thrown in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php on line 223
Any one can help me. Thanks in advance.
There may be a corrupted generated PHP file. Try this :
composer run-script post-install-cmd
I need help, I don't understand what this error mean! I'm using symfony2 and I'm biggners,
Fatal error: Uncaught exception
'Symfony\Component\Debug\Exception\ContextErrorException' with message
'Warning:
file_get_contents(C:\wamp\www\teva_com\src\Softivendor\MainBundle/Resources/views/Frontend/index.html.twig):
failed to open stream: No such file or directory' in C:\Program
Files\EasyPHP\data\localweb\teva_com\vendor\twig\twig\lib\Twig\Loader\Filesystem.php:130
Stack trace: #0 [internal function]:
Symfony\Component\Debug\ErrorHandler->handleError(2,
'file_get_conten...', 'C:\Program File...', 130, Array) #1 C:\Program
Files\EasyPHP\data\localweb\teva_com\vendor\twig\twig\lib\Twig\Loader\Filesystem.php(130):
file_get_contents('C:\wamp\www\tev...') #2 C:\Program
Files\EasyPHP\data\localweb\teva_com\app\cache\prod\classes.php(6334):
Twig_Loader_Filesystem->getSource('SoftivendorMain...') #3 C:\Program
Files\EasyPHP\data\localweb\teva_com\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php(126):
Twig_Environment->loadTemplate('SoftivendorMain...') #4 C:\Program
Files\EasyPHP\data\localweb\teva_com\vendor\ in C:\Program
Files\EasyPHP\data\localweb\teva_com\vendor\twig\twig\lib\Twig\Loader\Filesystem.php
on line 166
Could anyone help me and explain this so that I will understand it!
Thank you very much!
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.
If you use a docker container, the reason for this error might be that you have ran app/console cache:clear on your local machine, which in turn (re)generates some cache, specifically paths to view templates.
Which of course generates paths that are pointing to absolute paths of views on your host machine.
So try to execute app/console cache:clear on your container instead.
I'm developing in Ubuntu 14 and I get the following error when creating a databaes:
$ php app/console doctrine:database:create
This is the error output:
PHP Warning: require_once(/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache):
failed to open stream: No such file or directory in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
PHP Fatal error: require_once(): Failed opening required
'/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache'
(include_path='.:/usr/share/php:/usr/share/pear') in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
What Ive Tried
Running this in Vagrant
Running this Locally
This is one among several problem running Symfony2 under Ubuntu, the other forcing you to implement umask(0000) otherwise you have to get chmod +a permissions for log and cache folders, this seems like a bit of a hassle for something seemingly simple.
Does anyone know what to work around this error?
This should do the trick:
php /home/jesse/playground/www/symfony/htdocs/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
I have this error in my system in the production server, but I have no idea why cause in my development server everything run fine.
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Unable to load class "Twig_Extension_Escaper"' in /home/content/79/11253479/html/witf/path/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php:259 Stack trace: #0 /home/content/79/11253479/html/witf/path/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php(98): Symfony\Component\ClassLoader\ClassCollectionLoader::getOrderedClasses(Array) #1 /home/content/79/11253479/html/witf/path/app/bootstrap.php.cache(2303): Symfony\Component\ClassLoader\ClassCollectionLoader::load(Array, '/home/content/7...', 'classes', false, false, '.php') #2 /home/content/79/11253479/html/witf/path/app/bootstrap.php.cache(2139): Symfony\Component\HttpKernel\Kernel->doLoadClassCache('classes', '.php') #3 /home/content/79/11253479/html/witf/path/app/bootstrap.php.cache(2173): Symfony\Component\HttpKernel\Kernel->boot() #4 /home/content/79/11253479/html/index.php(27): Symfony\Component\HttpKernel\Kernel->handle(Object(S in /home/content/79/11253479/html/witf/path/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php on line 259
please try composer update -o and afterwards app/console cache:clear --env=prod.
Further check that the file vendor/twig/twig/lib/Twig/Extension/Escaper.php actually exists on your production server.