Fix WordPress, PHP, MariaDB, and Homebrew

TL;DR: If you find yourself setting up a new environment and you run into problems running WordPress, MariaDB, and PHP there are a few things to remember. Here’s what and here’s how to fix it.

I’m working on a longer post about how I set up my latest development environment but, in the mean time, hit a wall when working with the following requirements:
We recommend servers running version 7.4 or greater of PHP and MySQL version 5.7 OR MariaDB version 10.2 or greater.

Requirements, emphasis mine

Note that I use Homebrew to manage all of my packages and use Laravel Valet, WordPress, MariaDB, and PHP along with wp-cli. I’ll more on this in an upcoming post.

I’ve been talking with a few people on Twitter about it and it turned into a fun discussion.
Anyway, if you’ve followed any of this – or even if not and you’re experiencing this – then here’s a resolution for you.

Fix WordPress, PHP, MariaDB, and Homebrew
First, note that you cannot use WordPress and PHP 8. The truth is, PHP 7.4.27 is the most recent compatible version in my experience that works with WordPress.
It’s almost the most recent version that’s not deprecated in the Homebrew Formulae. 🤷🏻‍♂️
Anyway, the first thing to do is to make sure that you when you install PHP and if you’re doing so with Homebrew, you do the following:
$ brew install [email protected]
$ brew link –force –overwrite [email protected]
This will make sure that you’ve installed the most recent version while symlink’ing it properly so your using it on your system.
Next, you need to update the environment paths:
$ echo ‘export PATH=”/opt/homebrew/opt/[email protected]/bin:$PATH”‘ >> ~/.zshrc
$ echo ‘export PATH=”/opt/homebrew/opt/[email protected]/sbin:$PATH”‘ >> ~/.zshrc
$ source ~/.zshrc
This makes sure the PHP 7.4 binaries are accessible in your shell and reloads the current terminal session with the new version.
You can verify this works by running:
$ which php
Then reviewing the output.

Finally, I’m going to assume you’ve created your own wp-config.php file and populated:


From here, you can this issue the following wp commands in your terminal to set up the database (I’m including a `drop` statement just in case you’ve happened to set up the database without success prior to downgrading PHP).
$ wp drop
$ wp create
$ wp core install
For this last step, you’ll need to provide some additional arguments all of which I’ll include in the fully commented gist at the end of the article.
Terminal Commands to Set Up PHP and WordPress with MariaDB
View the code on Gist.
Share This StuffTwitterFacebookLinkedInRedditPocketMoreEmail



Leave a Comment

Your email address will not be published.

Table of Contents

On Key

Related Posts

Best Google Maps Plugins for WordPress

Before we start looking at any plugins, it’s good to review the way Google Maps work. There are several components in the Google Maps API family, all of which can be found on the Google Maps API Family page. When working with WordPress, we are mainly interested in two of these APIs: Static Maps APIMaps

How to Get a Custom Field Value via Shortcode

Sometimes we want to make it easy for site administrators to include the value of a custom field (maybe created as part of a custom meta box) into a post. An ideal solution to this challenge is to use shortcodes. You can either do this through these two plugins: Get Custom Field Values Custom Fields

Best Auto Translation Plugins for WordPress

Having the content of your website available in different languages can mean a much bigger audience for you. A very simple way to do this is to provide automatic translators, they’re not the same as manually translating all your content, but do a pretty good job. It’s better to have an automatic translation plugin than

Best WordPress Multilanguage Plugins

The two main contenders as best multilanguage plugins for WordPress are WPML and QTranslate. If you want a quick answer to which one comes out on top, I would say go for WPML. If you have enough time to give them a test drive, by all means, do so and judge for yourself which one