connecteev
3 weeks ago
332
9
Servers

Cant upgrade php version on MacOS Catalina

Posted 3 weeks ago by connecteev

I have a very annoying problem. I have 2 versions of PHP on MacOS Catalina, and no matter what I do, I cant seem to get rid of the old (php 7.3.x) version. I can't change anything in /usr/bin/ on my Mac, even though I'm an admin user.

The 2 versions of PHP are:

$ /usr/bin/php -v
PHP 7.3.11 (cli) (built: Apr 17 2020 19:14:14) ( NTS )
$ /usr/local/bin/php -v
PHP 7.4.9 (cli) (built: Aug  7 2020 19:23:06) ( NTS )

Even though which php and php -v use 7.4:

$ which php
/usr/local/bin/php
$ php -v
PHP 7.4.9 (cli) (built: Aug  7 2020 19:23:06) ( NTS )

The problem is that when my cron job runs, it uses /usr/bin/php (version 7.3.x), making my cron job fail (turns out some Laravel package code - specifically Mailcoach - is not compiant with php 7.3.* and NEEDS php v 7.4 or above.

This is what my PATH variable looks like:

$ echo $PATH
/usr/local/bin/php:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:./vendor/bin:/usr/local/sbin:/Users/kunalpunjabi/.composer/vendor/bin:/usr/local/mysql/bin:/usr/local/bin/mysql

If you've encountered this before or know how to fix it, please help!

Please sign in or create an account to participate in this conversation.