DEV Community

Cover image for Upgrade to PHP 8.x.0-dev with Homebrew on Mac
Sesha
Sesha

Posted on

3 2

Upgrade to PHP 8.x.0-dev with Homebrew on Mac

Now, PHP 8.0.0 Release Candidate 4 available for testing, It's expected to release on November 26, 2020, It's a new major version, and a lot of improvements and new features.

Here, step by step process to install PHP 8.0.0-dev with Homebrew on Mac.

Make sure brew up to date with the following command

  brew update
Enter fullscreen mode Exit fullscreen mode

At the time of writing this article, brew doesn't support php8, So we install using this git repo

Add the tap

Fetch the formulae in this tap.

brew tap shivammathur/php
Enter fullscreen mode Exit fullscreen mode

Install PHP 8.0

brew install shivammathur/php/php@8.0
Enter fullscreen mode Exit fullscreen mode

and finally, link with PHP 8.0

brew link --overwrite --force php@7.3
Enter fullscreen mode Exit fullscreen mode

Check the current version by running PHP -v:

PHP -v
Enter fullscreen mode Exit fullscreen mode

And restart the Restart Nginx or Apache:

sudo nginx -s reload

//or 

sudo apachectl restart

Enter fullscreen mode Exit fullscreen mode

And also you check your local web server using the current version by running the following script.

// create index.php file, this should be accessible to your web server

phpinfo(); die();
Enter fullscreen mode Exit fullscreen mode

Switching between versions.

If you want to switch back to PHP 7.4, here you can do that.

Unlink the current version like this

brew unlink PHP
Enter fullscreen mode Exit fullscreen mode

and link to PHP 7.4

 brew link --overwrite --force php@7.4
Enter fullscreen mode Exit fullscreen mode

if you want to link to PHP 7.3

 brew link --overwrite --force php@7.3
Enter fullscreen mode Exit fullscreen mode

If you like, please like and follow me to do more like this. Thank you!.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (1)

Collapse
 
leslieeeee profile image
Leslie

For PHP users, there is a tool called ServBay.dev that provides a much easier way, especially for beginners. It handles all versions of PHP, MariaDB, PostgreSQL, as well as Redis and Memcached. You can run multiple PHP instances simultaneously and switch between them effortlessly, without the need for any environment setup. This tool has simplified my PHP development and is definitely worth a try!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️