Home / Tutorials / How to install PHP 8 on macOS Big Sur using Homebrew
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.

10 mins

51.4K

3 years ago

0 comments

Beginner

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.

Step 1: 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 https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: 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]

Step 3: 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.
/usr/local/etc/php/8.0/php.ini

Step 4: 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]

Step 5: 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.
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this