Tips and tricks
Tired of using MAMP ?
You should already have Apache installed on mac
you just need to start it:
sudo apachectl start
restart:
sudo apachectl restart
check config:
apachectl configtest
optional, if you are on Mac OS X Monterey you might need to uninstall the default Apache 2.4
sudo apachectl stop sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null brew install httpd
to check if you have httpd running you can do $ps -ef |grep httpd
ps -ef |grep httpd 0 4182 1 0 Mon01PM ?? 0:01.16 /Applications/MAMP/Library/bin/httpd -f /Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf -k start 501 4183 4182 0 Mon01PM ?? 0:00.00 /Applications/MAMP/Library/bin/httpd -f /Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf -k start 501 4189 4182 0 Mon01PM ?? 0:00.02 /Applications/MAMP/Library/bin/httpd -f /Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf -k start 501 24659 24648 0 12:33AM ?? 0:00.00 /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND 501 24661 24648 0 12:33AM ?? 0:00.01 /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND 501 24662 24648 0 12:33AM ?? 0:00.00 /opt/homebrew/opt/httpd/bin/httpd -D FOREGROUND
then you can do
$/opt/homebrew/opt/httpd/bin/httpd -V Server version: Apache/2.4.48 (Unix) Server built: Jul 6 2021 20:11:03 Server's Module Magic Number: 20120211:105 Server loaded: APR 1.7.0, APR-UTIL 1.6.1 Compiled using: APR 1.7.0, APR-UTIL 1.6.1 ...
Access the config from /private/etc/apache2/httpd.conf — /opt/homebrew/etc/httpd/httpd.conf ( homebrew ) ->

start the server
/opt/homebrew/bin/httpd -k start
install php
brew unlink php && brew link --overwrite --force php@8.0
add this in your conf file
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.soSetHandler application/x-httpd-php
make sure DirectoryIndex includes php

Add a virtual host
You can add unlimited virtual hosts just like MAMP adds them. You can just access /private/etc/apache2/httpd.conf and add:
<VirtualHost *:80> ServerName devsite DocumentRoot "/Users/123/Dropbox/hosts/devsite" Protocols h2 h2c http/1.1 <IfModule xsendfile_module> XSendFilePath "/Users/123/Dropbox/hosts/devsite" </IfModule> ServerAlias devsite.* <Directory "/Users/123/Dropbox/hosts/devsite"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All <IfModule authz_host_module> Require all granted </IfModule> Allow from all </Directory> <IfModule wsgi_module> WSGIDaemonProcess devsite processes=2 threads=15 WSGIProcessGroup devsite WSGIScriptAlias /devsiteWsgiApp "/Users/123/Dropbox/hosts/devsite/wsgiapp.py" </IfModule> </VirtualHost>
Add mysql
Normally, you can just install the native mysqld service
you will find it in system preferences > mysql
you can use a tool like MySQL Workbench to see currently running mysql

check currently running mysql instances with $ps aux | grep mysql
you can change the MySQL socket from the php.ini
; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. ; http://php.net/mysqli.default-socket mysqli.default_socket =
Add xdebug
Normally, you can just install the native mysqld service
pecl install xdebug
normally this will be added to php.ini
zend_extension="xdebug.so"
using XDebug 3 – for phpstorm, you would also need to add
xdebug.mode=debug
xdebug.remote_port=9000
xdebug.client_port=9003
xdebug.client_host=localhost