选择对应版本的mysql下载安装:https://dev.mysql.com/downloads/mysql/

安装输入密码后,配置软连接
sudo ln -sv /usr/local/mysql-8.0.30-macos12-x86_64/bin/mysql /usr/local/bin
sudo ln -sv /usr/local/mysql-8.0.30-macos12-x86_64/bin/mysqldump /usr/local/bin


brew install php



To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php_module /usr/local/opt/php/lib/httpd/modules/libphp.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/8.1/
To restart php after an upgrade:
brew services restart php
Or, if you don't want/need a background service you can just run:
/usr/local/opt/php/sbin/php-fpm --nodaemonize
brew services start|stop|restart php


lsof -Pni4 | grep LISTEN | grep php

brew install nginx
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To restart nginx after an upgrade:
brew services restart nginx
Or, if you don't want/need a background service you can just run:
/usr/local/opt/nginx/bin/nginx -g daemon off;
==> Summary
🍺 /usr/local/Cellar/nginx/1.23.1: 26 files, 2.2MB
==> Running `brew cleanup nginx`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
brew services start|stop|restart nginx

brew install phpmyadmin
To enable phpMyAdmin in Apache, add the following to httpd.conf and
restart Apache:
Alias /phpmyadmin /usr/local/share/phpmyadmin
<Directory /usr/local/share/phpmyadmin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
</Directory>
Then open http://localhost/phpmyadmin
The configuration file is /usr/local/etc/phpmyadmin.config.inc.php
==> Summary
🍺 /usr/local/Cellar/phpmyadmin/5.2.0: 3,553 files, 44.7MB
// $i++;
/* Authentication type */
// $cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
// $cfg['Servers'][$i]['host'] = 'localhost';
// $cfg['Servers'][$i]['compress'] = false;
// $cfg['Servers'][$i]['AllowNoPassword'] = false;
$i++;
$cfg['Servers'][$i]['host'] = '127.0.01';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
127.0.0.1 pma.monnys11.net
echo '
server {
listen 80;
root /usr/local/share/phpmyadmin;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name pma.monnys11.net;
client_max_body_size 8M;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri =404;
# fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_max_temp_file_size 0;
fastcgi_buffer_size 4K;
fastcgi_buffers 64 4k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
' > pma
brew services restart php
brew services restart nginx


fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

