Sylius cache management - symfony

When I started to use Sylius I did not realize that it is not stable yet and I fully customized the dev version instead of starting a new project. Now, I think that I can't put it in prod because of cache management :
Images do not always load but sometimes :
Resource interpreted as Image but transferred with MIME type text/html
Same for CSS and JS :
net::ERR_CONNECTION_RESET
And I can't clear the cache with php app/console cache:clear -e prod :
Clearing the cache for the prod environment with debug true
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98304 bytes) in C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php on line 98
PHP Stack trace:
PHP 1. {main}() C:\wamp\www\sylius\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
PHP 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96
PHP 5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191
PHP 6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905
PHP 7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244
PHP 8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83
PHP 9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120
PHP 10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47
PHP 11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98304 bytes) in C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php on line 98
Call Stack:
0.0005 331032 1. {main}() C:\wamp\www\sylius\app\console:0
0.0698 3608112 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28
0.0764 3860448 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
0.6014 15730344 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96
0.6027 15730344 5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191
0.6034 15755448 6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905
0.6037 15755792 7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244
0.7519 16165176 8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83
7.0263 57502064 9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120
14.6093 95010368 10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47
21.6284 133900880 11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62
EDIT : I already cleared the cache manually but it didn't change anything.

Try this:
#!/user/local/bin/php app/console cache:clear --env=prod
The answer is based on symfony documention:
https://symfony.com/doc/2.8/console/usage.html

Related

Symfony2.8.48 Installed Successfully,but server could not start on windows10:testing commands php app/console server:run,php bin/console server:run

List item
C:\xampp\htdocs\Symfony\nnokox>php app/console server:run
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\xampp\htdocs\Symfony\nnokox\vendor\doctrine\doctrine-bundle\DependencyInjection\DoctrineExtension.php on line 326
PHP Stack trace:
PHP 1. {main}() C:\xampp\htdocs\Symfony\nnokox\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\xampp\htdocs\Symfony\nnokox\app\console:27
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:117
PHP 4. Symfony\Component\HttpKernel\Kernel->boot() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:62
PHP 5. Symfony\Component\HttpKernel\Kernel->initializeContainer() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:131
PHP 6. Symfony\Component\HttpKernel\Kernel->buildContainer() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:507
PHP 7. Symfony\Component\HttpKernel\Kernel->prepareContainer() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:600
PHP 8. Symfony\Component\HttpKernel\Bundle\Bundle->getContainerExtension() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:619
PHP 9. Symfony\Component\HttpKernel\Bundle\Bundle->createContainerExtension() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Bundle\Bundle.php:77
PHP 10. class_exists() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Bundle\Bundle.php:208
PHP 11. Symfony\Component\Debug\DebugClassLoader->loadClass() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Bundle\Bundle.php:0
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\xampp\htdocs\Symfony\nnokox\vendor\doctrine\doctrine-bundle\DependencyInjection\DoctrineExtension.php on line 326
Call Stack:
0.0005 234536 1. {main}() C:\xampp\htdocs\Symfony\nnokox\app\console:0
0.0565 2067176 2. Symfony\Component\Console\Application->run() C:\xampp\htdocs\Symfony\nnokox\app\console:27
0.0694 2338448 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:117
0.0695 2338712 4. Symfony\Component\HttpKernel\Kernel->boot() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:62
0.0882 2616632 5. Symfony\Component\HttpKernel\Kernel->initializeContainer() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:131
0.0955 2692280 6. Symfony\Component\HttpKernel\Kernel->buildContainer() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:507
0.1374 3233328 7. Symfony\Component\HttpKernel\Kernel->prepareContainer() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:600
0.1940 4338728 8. Symfony\Component\HttpKernel\Bundle\Bundle->getContainerExtension() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:619
0.1940 4338984 9. Symfony\Component\HttpKernel\Bundle\Bundle->createContainerExtension() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Bundle\Bundle.php:77
0.1941 4339264 10. class_exists() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Bundle\Bundle.php:208
0.1941 4339808 11. Symfony\Component\Debug\DebugClassLoader->loadClass() C:\xampp\htdocs\Symfony\nnokox\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Bundle\Bundle.php:0
C:\xampp\htdocs\Symfony\nnokox>php bin/console server:run
Could not open input file: bin/console
The first error is because you're using php version older than 5.5 which introduced the ::class support which your php complains about.
The second error means exactly what it says, the bin/console file does not exist, that's because it does not exist with Symfony 2.

How can we run the unit tests of civicrm from script?

I execute this commande line to run a unit tests :
hatem.hadrich#pc_Hatem_Hadrich:/projet/tools$ php /scripts/phpunit CRM_AllTests
I have this error when i run a unit test from my local instance and i can not find a way to resolve it anyone can help me to fix this bug.
PHP Fatal error: Class 'CiviTestSuite' not found in /projet/../civicrm/tests/phpunit/CRM/AllTests.php on line 39
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:569
PHP 3. PHPUnit_TextUI_Command->run()
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:115
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest()
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:137
PHP 5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass()
phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php:65
PHP 6. PHPUnit_Runner_StandardTestSuiteLoader->load()
phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php:124
PHP 7. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/Runner/StandardTestSuiteLoader.php:39
PHP 8. PHPUnit_Util_Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:38
PHP 9. include_once() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:56
i have find a way to fix this bug, you must require_one for the bootstrap file inside CiviTest :
define('DRUPAL_ROOT', '/path_to_project');
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';

PHP Fatal error returned when creating a new Symfony3 Project [duplicate]

Am new to symfony and from last month am continuously installing new symfony project using following command on ubuntu from the terminal
# Linux, Mac OS X
$ symfony new my_project_name
and it was working perfectly until today, but than just checked the new version release, but now it started giving me following error
Downloading Symfony...
4.93 MB/4.93 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100%
Preparing project...
PHP Warning: require(/var/www/projectname/app/SymfonyRequirements.php): failed to open stream: No such file or directory in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/symfony:0
PHP 2. require() /usr/local/bin/symfony:10
PHP 3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP 4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP 6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP 7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP 8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65
PHP Fatal error: require(): Failed opening required '/var/www/projectname/app/SymfonyRequirements.php' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/symfony:0
PHP 2. require() /usr/local/bin/symfony:10
PHP 3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP 4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP 6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP 7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP 8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65
I have even check the symfony at location usr/local/bin/symfony and it was there.
It is a resolved issue that you need to specify the version you want to install. As described here and here, you need to:
Update your installer
>symfony self-update
or with sudo, depending on how you install it:
>sudo symfony self-update
Specify the version:
>symfony new my_project_name 3.0
Hope this helps.
UPDATE
With the correct resolutions of the bug on the Symfony installer, now the 3.0 is the default version. In other case, you can specify the complete version (with minor and major) as follows:
>symfony new my_project_name 3.0.0

Fixtures installation error in sylius?

I want to install fixtures in sylius i used below command to install it that are as below
php app/console sylius:install --fixtures
when i ran above command i get error as
>PHP Fatal error: Class 'ResourceBundle' not found in C:\wamp\www\sylius\sylius\vendor\symfony\symfony\src\Symfony\Component\Locale\Locale.php on line 51
PHP Stack trace:
PHP 1. {main}() C:\wamp\www\sylius\sylius\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\sylius\app\console:28
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\sylius\vendor\symfon
y\symfony\src\Symfony\Component\Console\Application.php:106
PHP 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\sylius\vendor\symfony\symfony\src
\Symfony\Bundle\FrameworkBundle\Console\Application.php:78
PHP 5. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\sylius\vendor\symfony\symfony\s
rc\Symfony\Component\Console\Application.php:193
PHP 6. Sylius\Bundle\CoreBundle\Command\InstallCommand->execute() C:\wamp\www\sylius\sylius\vendor\symfony
\symfony\src\Symfony\Component\Console\Command\Command.php:242
PHP 7. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\sylius\src\Sylius\Bundle\CoreBu
ndle\Command\InstallCommand.php:80
PHP 8. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute() C:\wamp\www\syliu
s\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:242
PHP 9. Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute() C:\wamp\www\sylius\sylius\vendor\doctr
ine\doctrine-fixtures-bundle\Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand.php:106
PHP 10. Doctrine\ORM\EntityManager->transactional() C:\wamp\www\sylius\sylius\vendor\doctrine\data-fixtures
\lib\Doctrine\Common\DataFixtures\Executor\ORMExecutor.php:85
PHP 11. call_user_func() C:\wamp\www\sylius\sylius\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:2
23
PHP 12. Doctrine\Common\DataFixtures\Executor\ORMExecutor->Doctrine\Common\DataFixtures\Executor\{closure}(
) C:\wamp\www\sylius\sylius\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:223
PHP 13. Doctrine\Common\DataFixtures\Executor\AbstractExecutor->load() C:\wamp\www\sylius\sylius\vendor\doc
trine\data-fixtures\lib\Doctrine\Common\DataFixtures\Executor\ORMExecutor.php:83
PHP 14. Sylius\Bundle\CoreBundle\DataFixtures\ORM\LoadCountriesData->load() C:\wamp\www\sylius\sylius\vendo
r\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Executor\AbstractExecutor.php:120
PHP 15. Symfony\Component\Locale\Locale::getDisplayCountries() C:\wamp\www\sylius\sylius\src\Sylius\Bundle\
CoreBundle\DataFixtures\ORM\LoadCountriesData.php:31
I try to install resource bundle when i got the above error but it also failed to install.
Is there any other way is avilable to install fixtures in sylius?
Please share some knowledge..Thanks in advance.
You need to have intl installed on your environment. Symfony does not provide a stub class for "en" locale.

How to set the classpath for Symfony Autoloader?

I renamed my working trunk to trunk-alldone, checked out a fresh copy of trunk, ran some symfony commands (like unit tests) on trunk, then deleted trunk and renamed trunk-alldone back to trunk.
Now when I try to run any symfony commands, I get:
sym cc
PHP Warning: require(/home/kiwi/checkouts/trunk-alldone/kiwi- web/plugins/kcEmailPlugin/l pleAutoload.class.php on line 123
PHP Stack trace:
PHP 1. {main}() /home/kiwi/checkouts/trunk/kiwi-web/symfony:0
PHP 2. include() /home/kiwi/checkouts/trunk/kiwi-web/symfony:37
PHP 3. sfCommandApplication->__construct() /home/kiwi/checkouts/trunk/kiwi-web/lib/vend
PHP 4. sfSymfonyCommandApplication->configure() /home/kiwi/checkouts/trunk/kiwi-web/lib
PHP 5. sfSymfonyCommandApplication->loadTasks() /home/kiwi/checkouts/trunk/kiwi-web/lib
PHP 6. class_exists() /home/kiwi/checkouts/trunk/kiwi-web/lib/vendor/symfony/lib/comman
PHP 7. sfSimpleAutoload->autoload() /home/kiwi/checkouts/trunk/kiwi-web/lib/vendor/symf
It's still looking for things in trunk-alldone!
How do I reset this to get it to look in the right place again?

Resources