Twig_Error_Loader - directory does not exist - symfony

I have this error when deleteing cache.
sudo php app/console cache:clear --env=prod --no-debug
[Twig_Error_Loader]
The "/Users/whitebear/CodingWorks/httproot/myapp/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/Resources/views" directory does not exist ("/Use
rs/whitebear/CodingWorks/httproot/myapp/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/Resources/views").
I deleted all vendor/* and reinstalled by composer, but this error continues.
sudo php app/console cache:clear
This command shows no error.

Remove cache manually - rm -rf var/cache/*
Clean spooled emails rm -rf SPOOL_DIRECTORY/*, by default rm -rf var/spool/*
Both from project root directory.

Related

Sonata admin styles/scripts not loaded with error 403

i have a problem with Sonata Admin bundle. (Symfony version 3.3.11, Sonataadmin 3.24) On localhost everything works fine, but on server all styles and scripts placed in web/bundles/sonataadmin and web/bundles/sonatacore directories is not loaded with error 403. Permission of directories is 777 for folders, 644 for files. How can i fix this problem? Thanks.
Can you try following:
php bin/console cache:clear --env=prod --no-debug
php bin/console assets:install --symlink --env=prod --no-debug
php bin/console assetic:dump --env=prod --no-debug
sudo setfacl -R -m u:www-data:rX path_to_your_project
Do you have result?
I solved this problem by running next command:
php bin/console assets:install

Error during composer install --no-dev option in ElasticBeanstalk with Symfony 2

I am deploying Symfony 2 app in ElasticBeanstalk but when I run this I get an error saying
ERROR: Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle class not found.
I have this config.
container_commands:
110-remove-pg:
command: "yum remove -y php56-pgsql"
120-install-pglib:
command: "yum install -y postgresql94-libs"
130-install-pg:
command: "yum install -y php56-pgsql"
140-clear-folder:
command: "rm -rf var/cache/* var/logs/* var/sessions/*"
150-folder-config:
command: "source .ebextensions/bin/folder.sh"
160-pre-cache-clear:
command: "php bin/console cache:clear --env=prod --no-debug"
170-run-export:
command: "export SYMFONY_ENV=prod"
180-composer-install-no-dev:
command: "composer.phar install --no-dev --optimize-autoloader"
190-post-cache-clear:
command: "php bin/console cache:clear --env=prod --no-debug"
200-assets-dump:
command: "php bin/console assetic:dump --env=prod --no-debug"
210-remove-dev-app:
command: "rm web/app_dev.php"
Seems like it is still triggering DEV option. If I remove --no-dev option it works fine. But I do not want DEV packages. Is there anyway to resolve this issue.
Alright I found the solution of this problem. Apparently you need to put
SYMFONY_ENV=prod
In environment variables list for this to work.

symfony2 after cache clear get blank page

I thought I solved a permissions issue by removing cached files, then giving 777 permissions, it works and shows the page for my site with the htaccess set to remove /web/app_dev.php. But if do php app/console cache:clear --env=prod it goes back to a blank page again and the permission go back to 755 , how do I change permission on the cache:clear thanks ?
rm -rf app/cache/*
rm -rf app/logs/*
chmod 777 -R app/cache
chmod 777 -R app/logs
Set the permissions like it says here in the documentation, using ACL, or with setfacl
http://symfony.com/doc/current/book/installation.html#configuration-and-setup

Unable to install Sylius with Composer

With composer, i tried to install Sylius via sylius/sylius and sylius/sylius-standard.
Installations have both ended like this :
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
It happens just after the parameters.ini initialization.
And after, the command line doesn't work (example : "app/console list" return nothing) although I'm in the project root directory.
Any idea, please ? Thanks.
I've gotten this error ( I'm not sure if it's the same place where your getting it ) and developed a solution that seems to work. Instead of running app/console cache:clear ( which I think gets run at the end of the composer install ), I run a bash script that opens the permissions before and after.
sudo sh clearCache
Contents of clearCache:
#!/bin/bash
chmod -R 777 app/cache/ app/logs/
su www-data -c "app/console cache:clear -e dev"
chmod -R 777 app/cache/ app/logs/
su www-data -c "app/console cache:clear -e prod"
chmod -R 777 app/cache/ app/logs/
I think I got this message during a composer install and was still able to continue via cd Sylius and app/console sylius:install. Just run this before and after installing and updates.

error about dependencies again and again

I took my project to another local computer and Im getting this error after requesting app_dev.php:
You must set up the project dependencies by running the following
commands: curl -s http://getcomposer.org/installer | php php
composer.phar install.
So I run those commands but the error is the same again...
You sure you use 2.0 version? Because composer is used in symfony 2.1
Can you show logs which occur when executing php composer.phar install?
Else try to:
Remove extra php word in curl -s http://getcomposer.org/installer | php php composer.phar install
Delete cache and make cache dir writable: sudo rm -rf app/cache/* && chmod a+rwx -R app/cache/*

Resources