$ brew update error: Not a valid ref: refs/remotes/origin/master fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree. $ rm -rf $(brew --repo homebrew/core) $ brew tap homebrew/core $ brew install nginx mysql $ brew services start nginx
启动系统自带 php 版本的 php-fpm 程序。
1 2 3 4 5 6 7 8 9 10 11 12
# 解决: # 1. ERROR: failed to open configuration file '/private/etc/php-fpm.conf': No such file or directory (2) $ sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf # 2. ERROR: No pool defined. at least one pool section must be specified in config file $ sudo cp /private/etc/php-fpm.d/www.conf.default /private/etc/php-fpm.d/www.conf
# 系统中并无 `/usr/var/log` 目录,修改配置 php-fpm.log 错误日志路径:error_log = /usr/local/var/log/php-fpm.log # ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2) $ sudo vi /private/etc/php-fpm.conf
$ mysql --version mysql Ver 8.0.23 for osx10.15 on x86_64 (Homebrew) $ brew services start mysql $ mysql -uroot phpcms < /Users/codezm/www/police/phpcmsv9.sql # mysql 8.0 对 enum 有更严格的要求,对插入数据的 `5724` 行开始起,修改 `enum` 字段默认值由 `''` 为 `'0'`。 $ vi /Users/codezm/www/police/phpcmsv9.sql $ mysql -uroot phpcms < /Users/codezm/www/police/phpcmsv9.sql
# 修改 mysql root 账号密码 $ mysql -uroot mysql> use mysql mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234';
# mysql 配置文件 $ ls -la /usr/local/etc/my.cnf
# brew services start mysql 实际上将 /usr/local/opt/mysql/homebrew.mxcl.mysql.plist 复制到 /Users/codezm/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# mysql.server start
# mysql 8.0 vim /usr/local/etc/my.cnf [mysqld] default_authentication_plugin=mysql_native_password # ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234';
$ vi /usr/local/var/log/nginx/error.log [error] 63127#0: *180 FastCGI sent in stderr: "PHP message: PHP Warning: POST Content-Length of 11096034 bytes exceeds the limit of 10485760 bytes in Unknown on line 0" while reading response header from upstream, client: 127.0.0.1, server: , request: "POST /index.php"
# 更改配置项值 $ vi php.ini upload_max_filesize = 100M post-max-size = 100M
# memcache-4.0.5.2 # pecl install -D 'enable-memcache-session="yes"' https://pecl.php.net/get/memcache-4.0.5.2.tgz # checking for the location of zlib... configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located # ERROR: `/private/tmp/memcache/configure --with-php-config=/usr/local/opt/php@7.4/bin/php-config --enable-memcache-session=yes' failed brew install zlib pecl download https://pecl.php.net/get/memcache-4.0.5.2.tgz tar zxf memcache-4.0.5.2.tgz cdcd memcache-4.0.5.2 /usr/local/opt/php@7.4/bin/phpize ./configure --with-php-config=/usr/local/opt/php@7.4/bin/php-config --enable-memcache-session=yes --with-zlib-dir="/usr/local/Cellar/zlib/1.2.11" make && make install
多个php版本切换使用
1 2 3 4 5
# 使用 php@7.2 版本 brew unlink php@7.4 brew link php@7.2
brew link --overwrite php@7.4
php 多版本启用
1 2
# listen=127.0.0.1:9074 vim /usr/local/etc/php/7.4/php-fpm.d/www.conf
# 获取主库临时密码 grep "A temporary password" /Volumes/work/web/databases/master-13306-8.0.23/error.log # 更改主库临时密码 mysql80-master -u root -p alter user "root"@"localhost" identified by "1234"; # 查看主库状态 show master status\G;
# 获取从库临时密码 grep "A temporary password" /Volumes/work/web/databases/slave-23306-8.0.23/error.log # 更改主库临时密码 mysql80-master -u root -p alter user "root"@"localhost" identified by "1234"; # 1130 - Host '127.0.0.1' is not allowed to connect to this MySQL server use mysql; update user set host ='%'where user ='root' and host ='localhost'; # 刷新使用权限命令 FLUSH PRIVILEGES;
# 从库订阅主库 change master to master_host='127.0.0.1',master_port=13306,master_user='root',master_password='1234',master_log_file='mybinlog.000002',master_log_pos=477; # 启动 slave 同步 start slave; # 查看同步状态 show slave status\G;
vim /usr/local/opt/mysql@8.0/homebrew.mxcl.mysql.plist