Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2023-02-17 01:12:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,480
Website GitHub

Upgrading PHP on macOS Catalina

Having a mare with this. Catalina ships with 7.3.29 and phpdoc requires a minimum of 7.4.0. Ideally I’d like to go up a bit higher. I have homebrew and XCode CLI utilities installed. Pretty much every online resource claims it’s simple:

> brew update
Already up-to-date.

> brew install php@7.4
Warning: No available formula with the name "php@7.4".
==> Searching for similarly named formulae and casks...
Error: No formulae or casks found for php@7.4.

> brew upgrade php
Error: No available formula with the name "php".

> brew install php@74 
Warning: No available formula with the name "php@74".
==> Searching for similarly named formulae and casks...
Warning: Error searching on GitHub: Validation Failed: [{"message"=>"The listed users, orgs, or repositories cannot be searched either because the resources do not exist or you do not have permission to view them.", "resource"=>"Search", "field"=>"q", "code"=>"invalid"}]
Error: No formulae or casks found for php@74.

Scratching my head a bit, I then tried the recommended third party brew tap repository:

> brew tap shivammathur/php
Cloning into '/usr/local/Homebrew/Library/Taps/shivammathur/homebrew-php'...
...
Tapped 20 formulae (77 files, 3.2MB).

> brew install shivammathur/php/php@7.4
Warning: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from MacHomebrew on Twitter.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

Warning: shivammathur/php/php@7.4 has been deprecated because it is a versioned formula!
Warning: No available formula with the name "bison" (dependency of shivammathur/php/php@7.4).
==> Searching for similarly named formulae and casks...
==> Casks
bisq

To install bisq, run:
  brew install --cask bisq

Waaaht? Okay, fine, I’ll try without the version number dot…

> brew install shivammathur/php/php@74
Warning: No available formula or cask with the name "shivammathur/php/php@74". Did you mean shivammathur/php/php@7.4, shivammathur/php/php, shivammathur/php/php@7.2, shivammathur/php/php@7.1, shivammathur/php/php@7.0, shivammathur/php/php@7.3, shivammathur/php/php@8.0, shivammathur/php/php@8.3, shivammathur/php/php@8.1, shivammathur/php/php@5.6 or shivammathur/php/php-debug?

*sigh* let’s go higher then. How about to PHP 8.0:

> brew install shivammathur/php/php@8.0
Warning: You are using macOS 10.15.
...
blah blah
...
Warning: No available formula with the name "httpd" (dependency of shivammathur/php/php@8.0).
==> Searching for similarly named formulae and casks...
==> Casks
httpie

To install httpie, run:
  brew install --cask httpie

Eh?

I tried various other permutations of brew upgrade php and brew install with and without version numbers, dots etc, and they all fail with one of the messages above. That error about not having permission to access GitHub is strange indeed, but whatever.

Anyone got any nuggets of wisdom on this? I’m going round in circles. The official homebrew extension page for shivammathur lists a bunch of available PHP packages but then goes on to list macOS compatibility as only the latest three: Big Sur, Monterey and Ventura, which won’t (officially) run on my old MacBook without some hackery. So maybe the issue is that Catalina is left in the cold here.

I’ve got MAMP installed with a later PHP version, but that only gets used when pointing the browser at the web server on localhost:8888, not the system at large. Can I hack it and symlink the system to point at the version inside MAMP? Albeit that creates a problem when I upgrade it or uninstall it.

What about Laravel Valet? Could I install that and hack the macOS system to use it, so regular command line Terminal app scripts think that’s the one installed?

Help please!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2023-02-17 04:14:19

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,249
Website

Re: Upgrading PHP on macOS Catalina

Bloke wrote #334649:

I’ve got MAMP installed with a later PHP version, but that only gets used when pointing the browser at the web server on localhost:8888, not the system at large. Can I hack it and symlink the system to point at the version inside MAMP? Albeit that creates a problem when I upgrade it or uninstall it.

Would creating an alias in your .bashrc configuration work here ?

alias php=/path/to/mamp/… 

Then you can just do your usual CLI commands php doXYZ and they’ll use your own installed PHP instead of the system one. I do that with Python as the Apple (CLI tools) one is older than the Homebrew one.

A other option, build PHP from source – and have a little hair-pulling exercise with the (necessary) dependencies.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2023-02-17 10:29:47

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,480
Website GitHub

Re: Upgrading PHP on macOS Catalina

I’ll give the alias trick a go, thanks. Figured it wouldn’t be that simple as it might have libraries smattered across the system. Worth a shot though.

And yeah, compiling from source occurred to me after posting, but I gotta be real desperate to try!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2023-02-21 18:26:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,480
Website GitHub

Re: Upgrading PHP on macOS Catalina

As a follow-up, the alias thing works a treat for anything started form a shell (like manually invoking it) but anything that uses it programatically seems out in the cold. Though I just recalled I didn’t export the alias so maybe that will help. I’ll try that.

Failing that, it’ll likely be the drastic measure of actually symlinking from /usr/bin/local/php to the version of choice. That’s a pain though because it means each time I want to change PHP version I need to turn off SIP, make the change, then re-enable SIP. That’s two reboot cycles.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2023-02-22 01:15:35

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,249
Website

Re: Upgrading PHP on macOS Catalina

Probably a bit of voodoo…

Is MAMP specified in your $PATH ? In your bashRC / bash config, that is

I have no idea how phpdoc places the calls to PHP, might be worth if checking and seeing if you can alter that


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#6 2023-02-22 12:12:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,480
Website GitHub

Re: Upgrading PHP on macOS Catalina

phiw13 wrote #334696:

Is MAMP specified in your $PATH ? In your bashRC / bash config, that is

No, but that’s an interesting avenue to explore if I elevate the MAMP dir ahead of /usr/local in the list.

I have no idea how phpdoc places the calls to PHP

Me neither, but it seems to transcend the shell. No matter what I do (so far) it always picks up the system version.

phpdoc isn’t the only thing I’d like to run that has dependencies on the system PHP version, but it seemed a good starting point. Incidentally, there are rumblings on Reddit etc that phpdoc is going to become a relic of the past now that PHP attributes (type hinting, etc) are available in PHP 8.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2023-02-25 19:22:33

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,298
GitHub

Re: Upgrading PHP on macOS Catalina

Bloke wrote #334653:

And yeah, compiling from source occurred to me after posting, but I gotta be real desperate to try!

Been there, solved that. Shout if you want a script to crib.

The other thing to consider is a virtual machine. Spinning up a Linux ISO in a VirtualBOX session with a static IP is pretty straightforward and you have the benefits of (among other things) snapshotting, multiple PHP versions, air gapping so you don’t inadvertently break your host OS and an environment that’s pretty close to production if you’re headed that way. Well-supported Linux (e.g. Debian, Ubuntu, the various CentOS successors) will run just fine. Think of virtual machines as cattle, not pets.

Offline

#8 2023-02-25 22:45:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,480
Website GitHub

Re: Upgrading PHP on macOS Catalina

Y’know, a VM has more promise than hacking macOS. Thanks for the eye-opener. The application I’m writing will need to run on various flavours of Linux and Windows at minimum anyway. I’m only testing and writing on macOS because its hardware is conveniently in my bag a lot.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#9 2023-02-26 13:45:47

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,298
GitHub

Re: Upgrading PHP on macOS Catalina

Bloke wrote #334766:

I’m only testing and writing on macOS because its hardware is conveniently in my bag a lot.

I feel ya. I also know what it’s like to lose half a day when you spanner a local library and break macOS…out comes Time Machine and some crossed fingers.

If you’d‘ve asked me 12 months ago, I’d‘ve said go with a minimal Ubuntu server ISO and build out what you need. Canonical are pushing various things these days – Ubuntu Pro and other services – that’s put me off a bit, especially since the output of apt has changed. I’m erring towards Debian for our next Textpattern server build: well-supported, boring, reliable, and much less likely to shovel a load of extra guff into a server installation.

There’s a minimal installer for Debian here if you want to play around, I daresay it’ll run quite happily on 1GB or 2GB of RAM so won’t redline your macOS host in the grand scheme.

Offline

#10 2023-02-27 02:02:14

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,249
Website

Re: Upgrading PHP on macOS Catalina

gaekwad wrote

I’m erring towards Debian[…]: well-supported, boring, reliable, and much less likely to shovel a load of extra guff into a server installation.

In other words exactly what you would expect from a server OS

Out of curiosity more that anything atm, how do the various CentOS successors fare ?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#11 2023-03-01 12:55:39

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,298
GitHub

Re: Upgrading PHP on macOS Catalina

phiw13 wrote #334789:

In other words exactly what you would expect from a server OS

Yup.

Out of curiosity more that anything atm, how do the various CentOS successors fare ?

I have three clients as CentOS émigrés, though they both had that hideous WHM/cPanel stuff on top so it may as well have been any OS underneath. I moved one over to Ubuntu LTS (this was before the Ubuntu Pro push began and the proliferation of snapd), the other two went over to CentOS-like successors – one to AlmaLinux, the other to Rocky Linux – still with the WHM/cPanel combo as a safety net. I’ve done a bit of testing on both successors, and they work fine…they tick the boxes for what you’d expect, but ask the same question in 3 and 5 years and you’ll get a better overview of which is best.

All three run monster Wordpress sites, and they run just fine, but golly jeepers Wordpress is hungry for resources on a big site. They’re used to paying extra for stuff, so there’s little to no optimisation going on, just bang the plugins into place and ratchet up the server spec until you’re not in the red zone.

Last edited by gaekwad (2023-03-01 14:52:58)

Offline

#12 2023-03-02 10:06:41

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 562

Re: Upgrading PHP on macOS Catalina

I noticed the advertising for Ubuntu Pro popping up in my terminal recently too and wondered what that was about. How different is Debian to Ubuntu? I know that Ubuntu is based off Debian but that’s about it, I’ve never really used it before.

As part of my job I have to maintain around 10 Ubuntu LTS servers and at home I play around with a number of Ubuntu LTS’ on Raspberry Pis and in virtual machines. Would there be much of a learning curve if I was to migrate away from Ubuntu to Debian (command differences etc.)? I mostly run web applications such as Textpattern, WordPress, and Moodle and use Apache, PHP, Samba, OpenSSH, MySQL, etc.

Last edited by Algaris (2023-03-02 10:08:15)

Offline

Board footer

Powered by FluxBB