Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

madprabh's avatar

PHP 7.3 to PHP 8 (on MacOS Big Sur - 11.0.1 ) not working

Hey Folks,

Anyone have any idea how to upgrade PHP version from Mac's default which is 7.3 in my case to PHP > 8.1. I have brew installed on my system and even when I install php using brew, although it says everything went well when I check

(base) madhu@Madhukars-MacBook-Air bin % php -v
WARNING: PHP is not recommended\nPHP is included in macOS for compatibility with legacy software.\nFuture versions of macOS will not include PHP.
PHP 7.3.22-(to be removed in future macOS) (cli) (built: Oct 30 2020 00:19:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.22, Copyright (c) 1998-2018 Zend Technologies
(base) madhu@Madhukars-MacBook-Air bin % 

I also tried setting the path like this in my ~/.zshrc

export PATH=$PATH:/opt/homebrew/bin

Still no luck.

Anyone has idea on what I am doing wrong?

0 likes
2 replies
madprabh's avatar
madprabh
OP
Best Answer
Level 8

Thanks @tray2

I figured out my problem. I was making a mistake in setting up the PATH environment variable. I ran the below command and got the problem

brew doctor

This indicated that I had set the wrong PATH to the php executable

I finally set the below in ~/.zshrc which sorted my problem

vim ~/.zshrc
export PATH="/opt/homebrew/bin:$PATH"

Thanks for trying to help me out. I thought I will post this so it might help someone else.

1 like

Please or to participate in this conversation.