First published on my website.
PHP 7.3 has been out for a couple of weeks now and if you're interested in upgrading, the process is super simple.
Note: This small guide if meant for Mac OS users. If you're a Windows user, a quick google search should help you out!
Let's update everything
To pull install or update any applications or services, I use a Mac OS package manager called Homebrew. Before we go about upgrading our PHP installation, lets' quickly run a Homebrew commands to update our formulae and Homebrew itself.
$ brew update
Upgrading PHP
Now that our formulae is updated, we can proceed to upgrade our PHP installation with the latest version available on Homebrew.
$ brew upgrade php
After the upgrade completes, you can open a new tab in your terminal and check your PHP version with php -v
. If all went well, you should see something like this:
PHP 7.3.0 (cli) (built: Dec 7 2018 11:00:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.0, Copyright (c) 1999-2018, by Zend Technologies
In only a couple of minutes, you're already upgraded to the latest version of PHP. Keep in mind that some packages or services you're using in your system or applications might not be updated just yet to work on PHP 7.3.
Bonus for Laravel users
If you're a Laravel user you're more than likely using Laravel Valet. In order to get Valet working on PHP 7.3, you simply need to update it to the latest version released. Just do a composer global update
to update all your globally installed Composer packages and then just do a valet install
.
Running valet install
again is necesarry to configure the installation to work with your new PHP version.
Warning: There are some known bugs with PHP 7.3 and Opcache when queueing emails in the Laravel framework so I encourage you to keep an eye on the issues in the Laravel repository on Github.
Top comments (7)
Easily Upgrade is to install via DOCKER.
Not a big Docker fan myself.
So, It doesn't make sense to write this article because of local-environment is past way of making Dev environment
Are you saying that everyone should be using Docker now for their local environment?
Exactly, Docker is silver bullet for team work and the faster roll out projects
Although I see the benefit of Docker, I don't think it's meant for every team. if you're deploying to a Docker container, sure, work on a docker container locally. But if you have zero docker containers on production, why work with Docker locally?
Laravel Valet is super light, fast and reliable and I don't ever need Docker for most of the projects I'm working on.
Thank you! It worked like a charm.
If you need upgrade only valet php version you can try:
brew upgrade valet-php@7.3