When trying to clear the cache on my symfony2 project, I am getting this error message:
PHP Fatal error: Call to undefined method Symfony\Component\Console\Output\ConsoleOutput::isVerbose() in /var/staging_www/www.sciforum.net/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php on line 87
Any idea? Thank you.
EDIT:
When trying to update vendors, I am getting this error message:
Clearing the cache for the dev environment with debug true
PHP Fatal error: Call to undefined method Symfony\Component\Console\Output\ConsoleOutput::isVerbose() in /var/staging_www/www.sciforum.net/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php on line 99
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.
Check your versions in composer.json (and double-check versions for Symfony-based libraries in composer.lock). isVerbose only became available in ConsoleOutput with version 2.4.
You may have some mixed versions of the Symfony libraries.
You can fixit if you delete the directories first:
sudo rm -rf app/logs
sudo rm -rf app/cache
I've had a similar problem. Disabling PHP opcache for CLI helped me.
Disable it in php.ini:
opcache.enable_cli=0
Save the file and try clearing the cache again.
Related
I have an error when i execute this command :
php app/console cache:clear --env=prod && php app/console cache:clear --env=dev && php app/console assets:install --symlink && php app/console assetic:dump
The error is :
[Symfony\Component\Debug\Exception\ContextErrorException] Catchable
Fatal Error: Argument 1 passed to
Sonata\AdminBundle\Security\Handler\RoleSecurityHandler::__construct()
must implement interface
Symfony\Component\Security\Core\SecurityContextInter face, null
given, called in
/opt/preprod/app/cache/pro_/ap_ProdProjectContainer.php on line 1923
and defined
Can you help i dont really know how to fix this
EDIT
I tried to backup
composer.lock
and
vendor
directory (and then delete them). Then i deleted mannually the cache.
Then i made a composer install but the error is back when i made the composer install.
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
[Symfony\Component\Debug\Exception\ContextErrorException]
Catchable Fatal Error: Argument 1 passed to Sonata\AdminBundle\Security\Handler\RoleSecurityHandler::__construct() must implement interface Symfony\Component\Security\Core\SecurityContextInterface, null given, called in /opt/preprod/app/cache/dev/appDevDebugProjectContainer.php on line 4984 and defined
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
php app/check.php give me everything is ok
So i dont find the way to solve this
What version of Symfony are you using? I would guess 2.8 or 3.0 since it looks like the version of SonataAdminBundle is not compatible with your Symfony version.
I've got a brand new laravel installation on DigitalOcean, which I'm attempting to run a basic `composer update' on. However, I'm seeing the following error come up every time I try to update. I can't solve the problem with composer cacheclear, deleting the vendor/compiled.php file, or even reinstalling the entire framework.
I don't understand exactly what the error is in the first place, so I'm a bit lost. Any tips on what's going on?
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundat
ion\Application::getCachedCompilePath() in /var/www/html/production/vendor/
laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.ph
p on line 28
Delete the vendor/compiled.php and run composer update.
Source: https://laracasts.com/discuss/channels/general-discussion/runtimeexception-on-fresh-install?page=1
I have a very weird issue since yesterday.
Running composer install on my production server causes this error... Keep in mind I do not get any error on my local server (Homestead VM).
Nothing to install or update
Writing lock file
Generating autoload files
Executing command (CWD): php artisan clear-compiled
Executing command (CWD): php artisan optimize
Generating optimized class loader
Compiling common classes
Script php artisan optimize handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
Exception trace:
() at phar:///home/site/public_html/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:177
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///home/site/public_html/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:91
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///home/site/public_html/composer.phar/src/Composer/Installer.php:342
Composer\Installer->run() at phar:///home/site/public_html/composer.phar/src/Composer/Command/InstallCommand.php:131
Composer\Command\InstallCommand->execute() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///home/site/public_html/composer.phar/src/Composer/Console/Application.php:146
Composer\Console\Application->doRun() at phar:///home/site/public_html/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///home/site/public_html/composer.phar/src/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar:///home/site/public_html/composer.phar/bin/composer:43
require() at /home/site/public_html/composer.phar:25
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]
So it seems the error appears in the post-install-cmd when php artisan optimize is set to run... The weird thing is that when I run all the post-install-cmd manually, I DO NOT get any error.
So I tried :
doing a composer selfupdate
Removing composer and re-installing it
Using composer.phar instead of the global one
doing composer dumpautoload
removing the composer.lock file
removing all cache composer clearcache
running a composer update, on production (desperate)
And still get the same error. Do you have any ideas ? I'm running out of keywords to find similar issues online.
Thanks a lot
EDIT :
Also failed to mentioned that the site is working fine.. No error when browsing.
EDIT 2 :
As per #marcanuy suggestion, I tried removing the vendor directory. While at it I also cleared compiled and composer cache. Composer re-downloaded/installed everything. And still get the same error.
EDIT 3 :
So I narrowed it down to this. I DO NOT GET THE ERROR IF I SET APP_DEBUG to true... When false, I get the error. Any idea why ?
FINAL EDIT :
Thanks to Ben Johnson who pointed me in the right direction... I checked my raw PHP logs, and yes they differ from the laravel logs (duh, should have thought of that). I saw a weird memory error in there, not related to the files in the error stack above :
[02-Jun-2015 14:05:01 Europe/Paris] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 64 bytes) in /vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 169
After the tada moment. I raised memory_limit and composer install ran without error, and with APP_DEBUG turned OFF.
Thanks a lot to everyone for your help.
Have you examined the raw PHP logs?
It is crucial to note that Laravel's logs do not contain all of the same information that PHP's raw error logs do. When using Laravel, always check the raw PHP logs when an error occurs and the visible output and Laravel log do not reveal the root cause.
It is equally crucial to note that Composer is subject to the whims of any PHP file that it loads and processes, which means that any type of error that might occur in a PHP file that is completely unrelated to Composer is capable of causing Composer to fail, oftentimes without explanation. However, the root cause is almost always apparent in the raw PHP logs.
The empty method signature at the top of your stack-trace is unusual. I suspect that if you check the raw PHP logs, you will find some unusual condition present that fully explains the sudden termination of composer.phar.
Please check there next and let us know what you find.
The problem is related to php artisan optimize and not the composor.phar as you can see in the Optimizing the Framework for Better Performance if APP_DEBUG is true you need to use --force option with the command. So to solve this error you need to change your composor.json line in "post-install-cmd" section from "php artisan optimize" to "php artisan optimize --force"
I am trying to install Laravel, but each time it returns the same error:
[ErrorException]
Array to string conversion
optimize [--force] [--psr]
Script php artisan optimize handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
[ErrorException]
Array to string conversion
optimize [--force] [--psr]
My steps:
Regardless of using root - sudo -s or Laravel Forge's default account Forge this error occurs
I have also chmod -R 777 app/storage to prevent any permission errors
Then using the following sudo composer install, sudo composer update, the error still persists:
Writing lock file
Generating autoload files
Generating optimized class loader
Compiling common classes [ErrorException] Array to
string conversion optimize [--force] [--psr]
Why am I getting this error?! Any help would be hugely appreciated.
I was trying to install symfony-cmf-standard using:
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
But I am getting the following error:
Could not open input file: app/console
Script sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occured when executing the cache:clear --no-warmup
I am running the command as an Administrator so it should not be a permission issue.
It gives error as when we use the command,
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
It creates symfony-cmf-standard folder as a project folder and starts installing dependencies but in between it tries to clear cache using
php app/console cache:clear
But as the current location is outside of the project folder it can not locate app/console so it fails.
Now if we change the directory to inside the project folder and clear cache manually by using command
php app/console cache:clear
It clears cache and then we need to again update dependencies using
php composer.phar update
It worked for me.
I've got an error cut also in the same case: "...PHP Fatal error: Class 'DOMDocument' not found..."
Works after:
install php-xml (can be optionally compiled with this option I suppose)
set date.timezone in /etc/php.ini
On my side with php7.0 I had to install :
php7.0-mbstring
php7.0-xml
Then it worked :)
This happens because of the following bug in DoctrinePHPCRBundle: https://github.com/doctrine/DoctrinePHPCRBundle/issues/17
To fix it, edit the file vendor/doctrine/phpcr-bundle/Doctrine/Bundle/PHPCRBundle/Resources/config/odm.xml inside your symfony-cmf-standard folder and replace this line:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\ODM\PHPCR\Mapping\Driver\DriverChain</parameter>
With this one:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain</parameter>
Now copy composer.phar inside your symfony-cmf-standard folder and run with administrator privileges the command:
php composer.phar update
Make sure these are installed:
php-mb or php54w-mbstring or php55w-mbstring
php-xml or php54-xml or php55w-xml
After spending a couple hours on the issue, under FreeBSD you need to install port textproc/php80-xmlreader as well.