So for the first blog of this new site I figured I’d start with something I recently attempted. Installing Craft CMS on macOS Sierra. This was an exploratory install to see what Craft’s abilities are compared to WordPress and how one compares to another.I’m not going to go over a line by line guide to installing but I am going to talk about some of the gotchas and my overall experience doing this install.
So my expectations going in to setup craft was that the process would be similar to WordPress. Craft is no where near as streamlined as in their current WordPress setup. Their documentation does list minimum requirements and I glanced it over and expected everything to be fine. I should have spent the extra 5 minutes maybe. Who knows if this would have made a huge difference.
After downloading Craft I dropped it in a folder on my development environment and went into my apache configs. I’m already setup to install vhosts so I just dropped this in my httpd-vhosts.conf file.
CustomLog "/private/var/log/apache2/craft.com-access_log" common
I then added a line to my /etc/hosts
Tried to hit dev.craft.com on my favorite browser and boom, my first roadblock happened. Craft CMS requires mcrypt. Having brew already installed I went to my terminal and just ran “brew install mcrypt”. Needless to say that did not solve my problem and probably installed a bunch of crap I didn’t really want in the first place. After some research I found a clean, working way to install mcrypt. Michael Gracie did a great write up on this that he posted on his website. I would recommend going there and following those steps to the letter. I’m not going to copy his content back here as he did a great job explaining everything.
After going through this process I restarted, tried to run craft again and … got past the mcrypt screen. I now met “requirements”. I proceeded to enter all the requested setup info. After submitting the last step I got an error message and a spinner. Nothing else happened… A refresh for the site now showed:
CDbCommand failed to execute the SQL statement: SQLSTATE: Syntax error or access violation: 1055 Expression #18 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘craft_test.structureelements.root’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
After more googling it turns out that craft doesn’t play nice out of the box with all version of mysql. Some things changed in mysql and craft decided not to make a patch backwards into the only stable release of craft though they claim the fix is live in the beta version (version 3). In the meantime though the internet again brings us the answer. Log in to your mysql instance via command line and run the following command:
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
At this point your problems should be solved…. well mostly… most likely if you’re like me 404’s don’t automatically redirect to the index.php so you’ll have to play with your urls to get the results correctly but you should now be able to get this….