Posts Learn Snippets Categories Tags About
How to install PHP 8 on macOS Big Sur using Homebrew cover

How to install PHP 8 on macOS Big Sur using Homebrew

Learn how to install PHP version 8 on macOS Big Sur easily using Homebrew package manager.

6 months ago

10 mins read


In this post, we'll be looking at how to install PHP 8 on macOS Big Sur using Homebrew. By right the steps will also work for the previous macOS versions like Catalina and Mojave.

Install Homebrew
The first step is to install Homebrew and this is a tool (package manager for macOS) that will allow us to install easily PHP and basically any other package/tools.
/bin/bash -c "$(curl -fsSL"

Install PHP
To install PHP we can use the command below. The first command will automatically install the latest version of PHP which is at the current moment of writing this post version 8.
brew install php

If other versions may be preferred we can specify the PHP version and the code will look like the following.
brew install [email protected]

The php.ini Config
The default PHP configuration should be sufficient to get started but if there are any other configurations, we can change them through the php.ini located on this path. Do note the PHP version number which in this case is version 8.

Check if PHP is running
To check if PHP is already running we can make use of the brew services command. First, we can list the services that we have installed.
brew services list

If PHP is not started we can then run the command below to start the service in the background.
brew services start [email protected]

Checking PHP Version
Lastly to check the PHP version do run:
php -v

By now you will have PHP running on the background process and every time you logged in to the system it will start by default. Thanks for reading and have a good try.