最近因为新买Mac M系列芯片笔记本,一直也没搭建过PHP的开发环境,花了一点时间特意在本机做了一次环境搭建测试具体如下。
软件清单
工具列表如下:
Xcode
VS Code
Homebrew
OpenSSL & wget
MySQL
Postgres
PHP多版本
Nginx
安装Xcode
xcode-select --install
VS Code安装此处略过。
安装homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
安装openssl与wget
brew install openssl
brew install wget
安装MySQL
brew install mysql
brew services start mysql
brew services list
# Intel x86 Chipset code /usr/local/etc/my.cnf |
# Apple Silicon M1 Chipset code /opt/homebrew/etc/my.cnf |
my.cnf的配置
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
# Add mode only if needed
sql_mode = "ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
使用安全密码
mysql_secure_installation
brew services restart mysql
PS:MySQL8认证需要更新每个用户mysql_native_password,但是用户名和密码前没有空格,请务必注意。
mysql> SHOW VARIABLES LIKE 'validate_password%';
mysql> SET GLOBAL validate_password.policy=LOW;
安装Postgres
brew install postgresql
b

博主因新买Mac M系列芯片笔记本,进行了PHP开发环境搭建测试。介绍了软件清单,包括Xcode、VS Code等工具的安装,还详细说明了MySQL、Postgres、多版本PHP的安装与配置,以及Nginx的安装、配置和测试,完成后可进行初步PHP开发。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



