Here is the error I am getting:
Script php artisan optimize handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output:
up
I believe this error results from not being able to find mcrypt
.
Script php artisan optimize handling the post-update-cmd event returned with an error
Apparently it is not quite that easy to install mcrypt
.
Install the php5-mcrypt
package, or verify that it has been installed correctly.
sudo apt-get install php5-mcrypt
Check whether mcrypt
has been installed and enabled for PHP:
php --ri mcrypt
You're done if it says:
mcrypt support => enabled
Otherwise, continue if it says:
Extension 'mcrypt' not present.
Verify that mcrypt.ini
is present in PHP's mods-available
directory.
ls /etc/php5/mods-available/mcrypt.ini
If it says No such file or directory
, create a symbolic link from mcrypt.ini
to PHP's mods-available
directory.
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
Enable the mod.
sudo php5enmod mcrypt
Restart apache.
sudo service apache2 restart
Check again whether mcrypt
is enabled.
php --ri mcrypt
The final steps were inspired by Vuk Stanković.
Okay, did some further research with Google and it seems that this has to do with the autoload caching from Composer. There are various ways on how you can solve this.
composer dump-autoload
This would re-create the autoload stuff for you and it should solve your problem for now.
If this doesn't help, try deleting everything and re-install fresh: [ref]
rm -rf /path/to/composer.lock /path/to/vendor/
composer install
This would re-create just about everything.
To fix this you need to install mcrypt
.
In ubuntu execute the following command:
sudo apt-get install php5-mcrypt
Then update composer:
composer update
Another solution for me, setting xdebug.scream = 1
gives problem:
1) Find xdebug configuration file.
$ sudo find / -name xdebug.ini
2) Edit file using any text editor.
$ sudo vi /your_path/xdebug.ini
3) Set xdebug.scream = 0
4) Reload server
$ sudo service apache2 reload
It looks like your laravel install did not run correctly and since part of the composer.json
runs the php artisan clear-compiled
and php artisan optimize
if your laravel application is not working then composer will fail.
Try running your composer update without invoking the Laravel scripts.
php composer update --no-scripts
After that you can either run the commands from the scripts block in your composer.json manually. Else you can just run a standard
php composer update
again which will run the scripts for you.
I had a similar issue when trying to run composer update and none of the solutions above had worked. It turns out I had 2 require sections in my composer.json which is actually wrong.
"require": {
"laravel/framework": "4.1.*"
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable",
"require": {
"barryvdh/laravel-ide-helper": "1.*",
"zizaco/confide": "3.2.x",
"laravelbook/ardent": "dev-master",
"zizaco/entrust": "dev-master"
},
"require-dev": {
"way/generators": "2.*",
"fzaninotto/faker": "1.3.*@dev"
}
Combining the two as below solved my issue.
"require": {
"laravel/framework": "4.1.*",
"barryvdh/laravel-ide-helper": "1.*",
"zizaco/confide": "3.2.x",
"laravelbook/ardent": "dev-master",
"zizaco/entrust": "dev-master"
},
If you still have a problem, try deleting the composer.lock and the vendor directory and run
mv ~/.composer/cache ~/.composer/cache.bak
To clear the composer cache and finally run
sudo composer install
This should solve the issue.