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
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
Install PHP 8.0
brew install shivammathur/php/php@8.0
and finally, link with PHP 8.0
brew link --overwrite --force php@7.3
Check the current version by running PHP -v:
PHP -v
And restart the Restart Nginx or Apache:
sudo nginx -s reload
//or
sudo apachectl restart
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();
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
and link to PHP 7.4
brew link --overwrite --force php@7.4
if you want to link to PHP 7.3
brew link --overwrite --force php@7.3
If you like, please like and follow me to do more like this. Thank you!.
Top comments (1)
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!