Reference: macOS 11 Big Sur Nginx Setup: Multiple PHP Versions
Other Refs:
How to setup macOS Multi PHP Development Environment with MySQL and phpmyadmin
Don’t use the default homebrew core tap for PHP. Use shivammathur/php.
brew tap shivammathur/php
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
Next, set PHP 7.4 as your default php CLI version.
brew unlink php
brew link --overwrite --force [email protected]
Update /usr/local/etc/php/7.4/php-fpm.d/www.conf
# default
user = _www
group = _www
listen = 127.0.0.1:9000
# change to
user = <your_username>
group = staff
listen = 127.0.0.1:9074
Once you are ready, start-up php-fpm for each version.
brew services start [email protected]
brew services start [email protected]
brew services start [email protected]
brew services start [email protected]
brew services start [email protected]
Check that you have processes running and validate your ports are correct.
sudo lsof -i -n -P|grep php-fpm
Edit httpd.conf
to enable the following modules:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
Restart Apache
Update VHost entry
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/Users/web/work/clients/kcpa/kcpatax"
ServerName kcpatax.dv
<Proxy "fcgi://127.0.0.1:9073">
ProxySet timeout=3600
</Proxy>
<FilesMatch "\.php$">
SetHandler proxy:fcgi://127.0.0.1:9073
</FilesMatch>
</VirtualHost>