DEV Community

Ibrar Hussain
Ibrar Hussain

Posted on • Originally published at Medium

14

Installing PHP 8.0 on MacOS: Overcoming Disabled Versions

PHP is advancing rapidly, and now with PHP 8.3 in play, PHP 8.0 is no longer supported and not easy to install in the usual way. For instance, if you're a Valet user, you might face issues with commands like valet install php@8.0 or valet use php@8.0, and via brew, a message might appear, indicating:

Error: php@8.0 has been disabled because it is a versioned formula!
Enter fullscreen mode Exit fullscreen mode

For projects still relying on PHP 8.0, follow these steps for a solution:

Step 1

brew tap shivammathur/php
Enter fullscreen mode Exit fullscreen mode

Step 2

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

Step 3

php -v
Enter fullscreen mode Exit fullscreen mode

You should see the following result:

PHP 8.0.30 (cli) (built: Nov  7 2023 03:00:28) ( NTS )
Enter fullscreen mode Exit fullscreen mode

If you need older versions, like PHP 7.3, you can follow the same steps.

Step 4

For Valet users, linking PHP 8.0 is crucial. Use this command:

valet link php@8.0 
Enter fullscreen mode Exit fullscreen mode

This links PHP 8.0 to Valet, enabling you to switch between PHP versions seamlessly. For instance:

valet use php@8.0 
Enter fullscreen mode Exit fullscreen mode

I hope this guide proves helpful for you.

Happy coding!

References:

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs