Tuesday, December 1, 2015

Laravel Troubleshoot: Get the composer install working

In my spare time, I started my new hobby project. And I chose Laravel framework for this project. After a few weeks working on this project, I changed my workspace and started with a new clone from my git repository. But when I tried to run :

$ php artisan serve

the code seemed not working. I got this kind of error:

require(../bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in .../bootstrap/autoload.php on line 17
PHP Fatal error:  require(): Failed opening required '/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /../bootstrap/autoload.php on line 17

And I realized that I forgot to run:

$ composer install

a command to resolve all Laravel dependencies. But I got another error on that command :(

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for laravel/framework v5.0.14 -> satisfiable by laravel/framework[v5.0.14].
    - laravel/framework v5.0.14 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

So, I did my search on this error and found out that I needed to install another PHP extension my crypt with these commands:

$ sudo apt-get install mcrypt
$ sudo apt-get install php5-mycrypt
$ sudo php5enmod mcrypt

After that I ran the composer install to resolve all the dependencies and php artisan serve seemed to be working again :)


Tips: How to ssh to your Digitalocean server without password

If you are tired of being asked for a password when accessing your remote droplet servers in Digitalocean, you might consider adding an rsa ...