My composer won't update completely with Laravel 4 it gets stuck with artisan My composer won't update completely with Laravel 4 it gets stuck with artisan laravel laravel

My composer won't update completely with Laravel 4 it gets stuck with artisan


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.

  1. Install the php5-mcrypt package, or verify that it has been installed correctly.

    sudo apt-get install php5-mcrypt
  2. Check whether mcrypt has been installed and enabled for PHP:

    php --ri mcrypt
  3. You're done if it says:

    mcrypt support => enabled

    Otherwise, continue if it says:

    Extension 'mcrypt' not present.
  4. Verify that mcrypt.ini is present in PHP's mods-available directory.

    ls /etc/php5/mods-available/mcrypt.ini
  5. 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
  6. Enable the mod.

    sudo php5enmod mcrypt
  7. Restart apache.

    sudo service apache2 restart
  8. 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.


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.