Symfony cache:clear timeout - Exceeded 300 seconds - php

I'm having an issue with my Symfony 4.3 project and composer. Whenever I try to install, remove, or do anything, it just stops on the "Executing script cache:clear" part and sits there until the timeout hits. I've tried increasing the timeout to something crazy like 2000 and did not help, it would just sit there.
Anyone know how to fix this?
λ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process ""C:\wamp\bin\php\php7.3.9\php.exe" "--php-ini=C:\wamp\bin\php\php7.3.9\php.ini" "./bin/
console" --ansi cache:clear" exceeded the timeout of 300 seconds.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
I've tried manually deleting the var/cache contents, but it doesn't help. I have been looking all over the googles for an answer, and stackoverflow.

I found my issue. In my twig.yaml I had the node_modules folder path in there. I forgot to remove it when I was testing a css file and when the cache:clear does the warmup, it literally was going through a 100k of folders and files. Which explains why 300 seconds isn't enough time, and even if I had it set to 2000 seconds I bet it still would have ran out of time.
Lesson Learn: Be careful of your twig configurations!!!

I hope that this can be help, try in this way
composer install --prefer-dist --no-scripts -vvv

Related

Error while updating laravel from 6.03 to 6.18

I have this error when trying to upgrade my Laravel from 6.03 to 6.18
Could not delete D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate:
This can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed
PS D:\xampp\htdocs\XXXXX> composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 35 updates, 0 removals
- Updating laravel/framework (v6.0.3 => v6.18.35): Update failed (Could not delete D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate:
This can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed)
Would you like to try reinstalling the package instead [yes]?
- Removing laravel/framework (v6.0.3)
[RuntimeException]
Could not delete D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate:
This can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
PS D:\xampp\htdocs\BaladyFreshFarm>
You could try removing D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate
manually. If this not work, try restart and turn off antivirus, then try again.
Same happened with me and after several hours of debugging i found out:
Make sure your vscode or powershell or cmd has "Administrative" rights.
Make sure your web server is working fine.
What not to do:
In my situation nothing was wrong with Proxy and all it was just permission and working web
server. But i have to reinstall xampp to properly resolve this issue because i had tampered some files while debugging
Run your IDE or terminal like administrator, then try again.
I ran into this problem today. Delete the vendor folder then do a composer install. That should solve the problem.

failed to install composer packages in docker container

Since a few days i cant install composer-packages anymore in my local docker container.
I create new composer.json with composer init and try to add a package with composer require fzaninotto/faker
Always i get the same error message
# composer require fzaninotto/faker
Using version ^1.9 for fzaninotto/faker
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
Failed to download fzaninotto/faker from dist: The zip extension and unzip command are both missing, skipping.
Your command-line PHP is using multiple ini files. Run `php --ini` to show them.
Now trying to download from source
- Installing fzaninotto/faker (v1.9.1): Cloning fc10d778e4 from cache
fc10d778e4b84d5bd315dad194661e091d307c6f is gone (history was rewritten?)
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Failed to execute git checkout 'fc10d778e4b84d5bd315dad194661e091d307c6f' -- && git reset --hard 'fc10d778e4b84d5bd315dad194661e091d307c6f' --
fatal: failed to read object fc10d778e4b84d5bd315dad194661e091d307c6f: Operation not permitted
require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
First i guess my ssh key is the problem but i create a new one and add this to github with the same error.
Than i try it with composer clear and the problem don't resolved.
The problem come in EACH docker container and EACH composer packages... so i cant be a problem with single packages or container.
Have anyone an idea that i can do to use composer again?
If you're using Docker Desktop (Windows) and you updated to the latest version 2.2.0.4, then you get this issue.
Downgrade to the 2.2.0.3 and it should work again (at least it did for me).
See: https://forums.docker.com/t/issues-after-upgrading-docker-desktop-to-2-2-0-4/90589
To downgrade:
Uninstall Docker Desktop. Attention: it will delete your containers, save them before if you want to import them back
Go this page: https://docs.docker.com/docker-for-windows/release-notes/
Click Download under 2.2.0.3
Install Docker Desktop with the installer file
When started it will ask to upgrade to 2.2.0.4, just say "Skip this build"
I didn't have enough points to comment on the top answer but the Docker issue was just closed (like an hour ago!) and so simply updating Docker Desktop on Windows should fix it. Worked for me at least. Now I can install Drupal again!

Frustration Installing Laravel on Ubuntu

Now I remember why I never got into PHP. It's such a pain to set up. I spent a couple hours today trying to complete a coding challenge which required me to install Composer, Vagrant, VirtualBox and Laravel.
Somewhere along the line I think my permissions or something changed, because whenever I try to install Laravel...
composer global require "laravel/installer"
I get...
Changed current directory to /home/dilraj/.composer
[ErrorException]
file_put_contents(./composer.json): failed to open stream: Permission denied
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
I am not sure why I am getting this, perhaps it is because I have already done it, but regardless, when I try to create an executable command I am not seeing any results.
I edited the .bashrc file, as such...
export PATH="$PATH:$HOME/.config/composer/vendor/bin
source ~/.bashrc
I am not going to lie, I don't what this is even doing. I just want to make it so I can type 'laravel' and then start doing stuff, kinda like in npm.
Here are other things I tried but succeeded without any luck :(
export PATH="$PATH:$HOME/.composer/vendor/bin"
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
alias laravel='~/.config/composer/vendor/bin/laravel'
You don't you address the issue noted in the error, primarly Permission denied. Running chmod 755 .composer should be enough to give you permission to edit the file.
If that doesn't work, add sudo in front of it to update it using root account.
seems like you have install composer as root.
You can try to install laravel without Laravel Installer by run :
composer create-project --prefer-dist laravel/laravel projectfolder
It its not working, try using sudo command :
sudo composer create-project --prefer-dist laravel/laravel projectfolder

Composer install hangs at ScriptHandler::buildBootstrap

Sometimes, not every time, but with increasing tendency, i discover the following behaviour with composer install on a symfony project.
We are working with different branches here and after switching from a feature branch back to the master, a composer install is necessary.
Everything works fine, but at the last step, the script terminates after 300 sec while "buildBootstrap".
> post-update-cmd: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-update-cmd event terminated with an exception
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "'/usr/bin/php5' '--php-ini=/etc/php5/cli/php.ini' '/var/www/Project/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/../Resources/bin/build_bootstrap
.php' 'app' 'app' " exceeded the timeout of 300 seconds.
Exception trace:
() at phar:///var/www/Project/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php:1219
Symfony\Component\Process\Process->checkTimeout() at phar:///var/www/Project/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php:356
Symfony\Component\Process\Process->wait() at phar:///var/www/Project/composer.phar/vendor/symfony/process/Symfony/Component/Process/Process.php:210
Symfony\Component\Process\Process->run() at /var/www/Project/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:454
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeBuildBootstrap() at /var/www/Project/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:82
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap() at phar:///var/www/Project/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:211
Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///var/www/Project/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:167
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///var/www/Project/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:92
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///var/www/Project/composer.phar/src/Composer/Installer.php:346
Composer\Installer->run() at phar:///var/www/Project/composer.phar/src/Composer/Command/UpdateCommand.php:143
Composer\Command\UpdateCommand->execute() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
Symfony\Component\Console\Command\Command->run() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///var/www/Project/composer.phar/src/Composer/Console/Application.php:147
Composer\Console\Application->doRun() at phar:///var/www/Project/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///var/www/Project/composer.phar/src/Composer/Console/Application.php:82
Composer\Console\Application->run() at phar:///var/www/Project/composer.phar/bin/composer:43
require() at /var/www/Project/composer.phar:25
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]
After this error occured once, it is not possible any more to execute composer without hanging directly at the beginning.
$> php -d memory_limit=-1 composer.phar -vvv install
this will hang directly after pressing enter, no output, nothing. I reboot then the machine and maybe the next time is working, and sometimes not like described above.
Has anyone discovered the same thing?
ScriptHandler::buildBootstrap is the very first task at composer which executes code in your symfony project. This means, the php task is waiting for something and there are not so many things which could be in consideration here.
Are you simultaneously debugging with xdebug (mayby with a forgotten debug-session)? Is xdebug running in a debug session and waiting at a break point?
This could be the root cause.
The error you're receiving is stating that the time limit for executing the script has been exceeded. Defining -d memory_limit=-1 will only remove any memory limits. What you should do is to add -d max_execution_time=0 (docs). That should fix your problem.
One fix I found is to disable the xdebug for the CLI. The Composer project mentions this fix and also alias the php keyword and start the xdebug library only when using the php command.
More details here: https://getcomposer.org/doc/articles/troubleshooting.md#xdebug-impact-on-composer

Composer commands generate error on Windows 8 and Laravel 4

I am trying to run the command composer install from the command line and every time I do so I generate the following error:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","me
ssage":"main(): Failed opening required '..\/app\/controllers\/UsersController.p
hp' (include_path='C:\\xampp\\htdocs\\project\\html\\vendor\/phpseclib\/phpsecli
b\/phpseclib;.;C:\\xampp\\php\\PEAR')","file":"C:\\xampp\\htdocs\\project\\html\
\app\\filters.php","line":2}}Script php artisan clear-compiled handling the post
-install-cmd event returned with an error
[RuntimeException]
Error Output:
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-p
lugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress
] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [pac
kages1] ... [packagesN]
I also get the exact same error when running:
composer update
I am on Windows 8, using XAMPP, the PHP version is 5.5, and I am using Laravel 4. It is also worth noting that I copied this project from a Git repository and not create a project from scratch.
And I get the following response when trying to run the command php composer.phar update
Could not open input file: composer.phar
Thank you in advance! I am new to Laravel so feel free to spell things out for me, I might need it.

Categories