Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

How to upgrade to PHP 8.2 on Mac (and Laravel Valet)

Original – by Freek Van der Herten – 2 minute read

Now that PHP 8.2 has been released, it's time to upgrade the PHP of your Mac.

If you're using Brew - which you probably are - there are only a few steps involved.

Issue these commands

# let's make sure brew is up to date
brew update

# install php
brew tap shivammathur/php
brew install shivammathur/php/php@8.2

That's it! You can check the version of PHP you are running with this command.

php -v

This should output PHP 8.2.

Upgrading Laravel Valet

Here are some extra steps for Laravel Valet users to ensure you run your local websites on PHP 8.2.

I've noticed that Laravel Valet will not immediately pick up on the installed PHP 8.2

To upgrade, I ensured I was running the latest version of Valet.

composer global update

Next, you can force Valet to switch to php@8.2 using this command.

valet use php@8.2 --force

If you now add phpinfo() to one of your hosted sites, it should output PHP 8.2

And that's all there is to it!

EDIT: I haven't tested this but apparantly Laravel Valet users can upgrade to PHP 8.2 by issuing a single command.

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Comments

Sammy avatar

I've found a tool called ServBay.dev can provide much easier way for PHP developers, especially the beginners. It includes all versions of PHP, MariaDB, and PostgreSQL, as well as Redis and Memcached. Users can run multiple versions of PHP instances all at once. Trust me, it's made my PHP dev life a whole lot smoother. Might be worth a shot for you to check it out!

Comments powered by Laravel Comments
Want to join the conversation? Log in or create an account to post a comment.