PHP 8 on macOS 11 with HomeBrew

How to Install PHP 8 to macOS Big Sur Using Homebrew

As part of preparing a local development environment for CodeIgniter Wizard

Demonstrating a series of simple steps over the Mac's Terminal CLI, to install PHP 8.x on macOS Big Sur.

published on 24 Feb 2021 in Development on macOS PHP Web Development

In this tutorial, we'll install the latest version of PHP using Homebrew on macOS Big Sur, also known as macOS 11. This PHP installation features a rich set of extensions and libraries, including those required by version 4 of the CodeIgniter framework.

In the previous tutorial, we've already installed Homebrew on a fresh copy of macOS Big Sur.


brew install phpNow let's open Mac's Terminal app, and simply type:

brew install php
in the command prompt, and then hit the return key. In this process, your user account needs to have administrative privileges.

This installation may typically take a while, although in this video we fast-forwarded some parts for the sake of brevity. Depending on your system and Internet bandwidth, it can take up to an hour. Therefore be patient, and do not interrupt the installation to avoid polluting your system library directories with intermediate pre-mature installation files.

Homebrew prints some instructions for additional steps to be taken which would be needed to link this very PHP installation to the Apache web server that comes bundled with macOS - though we won't be using it in our demos. In other demos on this blog (and our YouTube channel), we will be testing the web applications created with CodeIgniter Wizard using the built-in web server functionality of the CodeIgniter framework making use of the PHP libraries we are installing in this demo now. Therefore in this tutorial, I will not go along those additional steps instructed by Homebrew. However you can easily save the entire Terminal output to a log file in text format, just in case you need to refer to those instructions later, in order to properly set up a complete web development environment manually by yourself.

Now that our PHP installation is complete, in another tutorial, we'll be demonstrating how to run a web application created with CodeIgniter Wizard on this configuration - so be sure to stay tuned...

Share this on

Comments

What do you think?
  • Archibald
    Archibald
    Do the instructions here apply for Catalina as well?
    • Rado
      Rado
      Yes, Homebrew there is pretty much the same.