DEV Community

Ibrar Hussain
Ibrar Hussain

Posted on • Originally published at Medium

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:

Top comments (0)