Troubleshooting Problems Installing Craft CMS on Laravel Homestead

Today I installed Craft CMS in for a new Praxis project. I use Laravel Homestead for my local development environment. It installs like pretty much every other PHP app on Homestead (use this guide by Matt Collins if you aren’t very familiar with Homestead), but I ran into a few annoying errors along the way:

Mcrypt is required

If Mcrypt is required shows when you first go to http://yoursite.local/admin to finish the install, it is probably because you are a good citizen and your Homestead box is actually up to date, running PHP 7.2 as the default. Here’s the issue: mcrypt was removed from PHP 7.2. Craft 2 still needs it. There are three solutions:

If you need PHP 7.2, you’ll have to install Craft 3. It is still under development as of this writing, so I didn’t take that path. (Update April 2, 2018 – Apparently Craft 3 is launching on April 4, so you won’t have this issue for long!)

You can install the mcrypt extension for PHP 7.2.

You can use a different PHP version. I took this route. Homestead makes this super simple by allowing multiple PHP versions. In your Homestead.yaml, set the php variable to php: "7.0" under your site in the Sites block. Here is what mine looks like:

- map: craft-praxis.local to: /home/vagrant/craft-praxis/public php: "7.0"

GROUP BY incompatible with sql_mode=only_full_group_by

If you see this message, chances are that you are using MySQL 5.7.5+, which changed the way it deals with GROUP BY. See this StackOverflow post for the two solutions: Removing the ONLY_FULL_GROUP_BY option from sql_mode or adding the initSQLs database config settings in craft/config/db.php.