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!
For projects still relying on PHP 8.0
, follow these steps for a solution:
Step 1
brew tap shivammathur/php
Step 2
brew install shivammathur/php/php@8.0
Step 3
php -v
You should see the following result:
PHP 8.0.30 (cli) (built: Nov 7 2023 03:00:28) ( NTS )
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
This links PHP 8.0
to Valet, enabling you to switch between PHP versions seamlessly. For instance:
valet use php@8.0
I hope this guide proves helpful for you.
Happy coding!
References: