Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-12-18 10:17:06

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

Alternative apache + php install

For many years I have relied on the default Apache+PHP install on macOS for my testing and playground. It looks like that might end soon, The default PHP issues a warning bout imminent removal1. (that was more or less announced two years ago or so at the WWDC).

Now looking at possible alternatives:

[1] Valet: (multi site) URL laravel.com/docs/8.x/valet It requires or depends on Homebrew packages. Also requires composer [-:(]. Jacob provides some tidbits here.

[2] Mamp: (free version: one site only, commercial/pro version is not so cheap – €90/¥9,600-)
www.mamp.info/en/mamp/support/
Possible to use different versions of PHP on a per site basis (I suppose this needs a server restart?).
Q -> is it possible to manage the DB via something more palpable than phpMyAdmin (Sequel Ace)?

[3]Xamp (poor, minimal docs)
–> www.apachefriends.org/download.html
–> www.apachefriends.org/faq_osx.html
(not fully clear to me yet what actually is installed here)

[4] via Homebrew (brew.sh), install apache + php. then manage as one would do with the build-in Apache/PHP combo – multiple PHP versions are possible with some command line dance
getgrav.org/blog/macos-bigsur-apache-multiple-php-versions

[5] Ultimate sandboxing: install Virtual Box + Ubuntu, then Apache/PHP/MySQL or alternatives and use that as the server.
Not researched yet, does anyone know a good text based tutorial ?

Note: nowadays, i have much less need for multiple local sites, esp. TXP ones. A couple of local test sites to experiment with templates etc.

1 “WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.”


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

Offline

#2 2020-12-18 10:43:59

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: Alternative apache + php install

phiw13 wrote #327596:

[5] Ultimate sandboxing: install Virtual Box + Ubuntu, then Apache/PHP/MySQL or alternatives and use that as the server.
Not researched yet, does anyone know a good text based tutorial ?

What about this short introduction for installing Virtualbox on MacOS?
How to Install a Windows 10 VirtualBox VM on macOS
You only have to use a Ubuntu ISO for installing, instead of Windows and that’s it. Virtualbox is in most cases (and if you don’t need something like 3D acceleration) pretty easy. And as soon as you have a working Ubuntu environment, everything else is related to Ubuntu. Network management in Virtualbox should be self explaining. On problems most solutions you can find in their official documentations: End-user documentation

Offline

#3 2020-12-18 10:47:49

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

Re: Alternative apache + php install

phiw13 wrote #327596:

WARNING: PHP is not recommended

*splutters* Wahhhht?

Anyway, I’d go with either the homebrew approach or VirtualBox as they give ultimate flexibility, but that’s probably just me. The downside is that the Homebrew approach requires XCode which is about eleventy trillion exabytes of bloaty crap and a few MB of useful libraries for web dev. Years ago I found a way to only install the tiny bits I needed, but sadly can’t remember where I found that info.

To switch PHP version wholesale, you could set up a tiny shell script line as an alias that takes a single argument: the version of PHP you want to switch to. Something like (untested):

alias chgphp='function _chgphp(){ brew unlink php && brew link --overwrite --force php@$1; };_chgphp'

so chgphp 7.4 would switch to PHP 7.4.

EDIT: I see there’s already an sphp script that does way more, including setting up Apache environment vars, so yeah, do that instead.

I’m not sure how easy it is to get Apache to use a different PHP version for each virtual host, as I never do that. I just let them all use the same version on my Linux box. Pete will likely know, as he does this for the demo server, I believe.

Last edited by Bloke (2020-12-18 10:49:17)


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 2020-12-18 10:51:30

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

Re: Alternative apache + php install

phiw13 wrote #327596:

For many years I have relied on the default Apache+PHP install on macOS for my testing and playground.

Now looking at possible alternatives:

[…]

[5] Ultimate sandboxing: install Virtual Box + Ubuntu, then Apache/PHP/MySQL or alternatives and use that as the server.
Not researched yet, does anyone know a good text based tutorial ?

This is one of the routes I use, but then I arguably have more-than-average experience with command line stuff given my server-side predilections.

I would also suggest a single-board computer like a Raspberry Pi. I use these en masse for much of my dev stuff, and they’re super. I definitely recommend having a single RPi with static IP on your own network, and using it as a) a Pi Hole ad sink, and b) your starter dev environment.

I have all the instructions for making VirtualBox & RPi stuff from scratch, but I need to gather them into an article or two. I am also very much in favour of not polluting a macOS environment with any more build tools than are necessary; if your station goes pop, then you have a lot more to rebuild…whereas if you outboard this stuff to a VM or RPi then you’re spreading the load a bit. Pros and cons to each approach, obviously, but since I’m not gentle with my computers here it works for me.

Offline

#5 2020-12-18 10:56:48

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,577
Website

Re: Alternative apache + php install

MAMP: MAMP is free. MAMP Pro is 79€ new (not 90€, was previously much cheaper :-/). It used to come with Sequel Pro bundled and that was definitely possible. Sequel Ace would therefore work too but not sure if it is bundled anymore.

Comparison of MAMP vs. MAMP Pro

I have never used NAMO and it’s not necessary (for local web sites) if you’re using MAMP Pro. It could be a plus with the free MAMP, though. Other hosts file editors for Macs include gasmask, iHost and Hostbuddy (see also VirtualHostX below).

Valet: Valet is free but Mac only and Nginx only (no Apache so .htaccess has no effect but clean urls work). Doesn’t work parallel to MAMP or other Webservers as far as I have read due to port conflicts. I read somewhere, you can switch MAMP to use other ports but have not tried it.

Once PHP versions are installed, quick switching with a command line (but I don’t think per site). Mailhog can be installed alongside it for catching local webserver email. Works fine with Sequel Pro/Ace.

….

Another option for Mac local Webserver environments is VirtualHostX.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2020-12-18 11:07:44

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,577
Website

Re: Alternative apache + php install

gaekwad wrote #327600:

I would also suggest a single-board computer like a Raspberry Pi … using it as a) a Pi Hole ad sink, and b) your starter dev environment.

… if your station goes pop, then you have a lot more to rebuild…whereas if you outboard this stuff to a VM or RPi then you’re spreading the load a bit.

I’m very intrigued by what you’ve written about this in various threads and maybe I’ll make it a project one day.

One reason I still work locally is that I work from two locations, and sometimes, especially in years like this last one, I’ve wanted to work elsewhere, e.g. outside where internet is not a given or away from home. I could set that up in multiple work locations but that’s also work to keep up to date.


TXP Builders – finely-crafted code, design and txp

Offline

#7 2020-12-18 11:11:31

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

Re: Alternative apache + php install

Bloke wrote #327599:

I’m not sure how easy it is to get Apache to use a different PHP version for each virtual host, as I never do that. I just let them all use the same version on my Linux box. Pete will likely know, as he does this for the demo server, I believe.

Unsure about Apache as I haven’t touched that in years. If you’re running PHP in its FPM guise, you should be able to point each virtual host file to the respective socket (file). Taking a step back, if you intend to run multiple PHPs on the same host, you might find an easy way with a control panel of sorts…I’m sure there’s pre-made server control panels that provide a friendly GUI way of managing all this stuff, otherwise you should prepare for many hours of finding your way around and learning as you go.

Not being deliberately vague, this is one of those moments that I realise I’ve sort of moved on from Apache and just don’t know it anymore.

Offline

#8 2020-12-18 11:13:32

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

Re: Alternative apache + php install

jakob wrote #327603:

I’m very intrigued by what you’ve written about this in various threads and maybe I’ll make it a project one day.

…and maybe this chatter is the impetus I need to get my bloody tutorials finished!

One reason I still work locally is that I work from two locations, and sometimes, especially in years like this last one, I’ve wanted to work elsewhere, e.g. outside where internet is not a given or away from home. I could set that up in multiple work locations but that’s also work to keep up to date.

Very valid, absolutely. Portable VM might be useful for that, though you’d have to sync it as you go from place to place.

Offline

#9 2020-12-18 11:49:58

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

Re: Alternative apache + php install

Bloke wrote #327599:

splutters Wahhhht?

They mean – the version provided is not recommended as a dependency for apps and the like as it will not be included in the future.

Anyway, I’d go with either the homebrew approach or VirtualBox as they give ultimate flexibility, but that’s probably just me. The downside is that the Homebrew approach requires XCode.

You can install just the command-line tools (~1Gb, lots of stuff you probably don’t need, or me). Download here.

To switch PHP version wholesale […]

EDIT: I see there’s already an sphp script that does way more, including setting up Apache environment vars, so yeah, do that instead.

That is the one from Homebrew, right ?


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

Offline

#10 2020-12-18 11:51:57

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

Re: Alternative apache + php install

whocarez wrote #327598:

What about this short introduction for installing Virtualbox on MacOS?

Thanks, but I expressed my self poorly, I meant to say, some tutorial(s) about installing the server stuff.


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

Offline

#11 2020-12-18 23:59:14

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Alternative apache + php install

I’ve always used coolestguidesontheplanet.com.

Offline

#12 2020-12-19 00:18:56

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

Re: Alternative apache + php install

gaekwad wrote #327600:

This is one of the routes I use, but then I arguably have more-than-average experience with command line stuff given my server-side predilections.

[referring to Virtualbox local hosting] Yeah, one reason you list below would be for me a good argument: easily portable or moved around in case the host machine goes pop, or in case a host machine OS upgrade cause trouble with non-default installed software.

One of the reasons I have over the past ~15years+ relied on the default installed Apache + PHP stack is that Apple is unlikely to break that.

I would also suggest a single-board computer like a Raspberry Pi.

For one this is completely outside of my competence and interest range, and two, I can install a server stack on my MBA and go out to sit in the park nearby and do some work while enjoying the outside air/sun/… or some other place.

I have all the instructions for making VirtualBox & RPi stuff from scratch, […]

If you found some time, a simple ordered list for VirtualBox would be great — a plain .txt file suffices :-). TY.


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

Offline

Board footer

Powered by FluxBB