Homebrew PHP 7.4升级在MacOS 10.15.1 Catalina上失败

时间:2019-12-01 03:05:08

标签: php macos homebrew macos-catalina php-7.4

我尝试将自制的PHP 7.3.12升级到PHP 7.4.0失败。

这是我所做的:

brew update
sudo brew services stop php
brew upgrade
brew cleanup
brew doctor
sudo brew services start php
brew services list
sudo reboot now

这就是我的期望:

要按预期恢复的服务器。

这是发生了什么:

WordPress 5.3前端和后端均报告可怕的“建立数据库连接错误”错误。

phpMyAdmin报告以下三个错误:

  1. 无法登录到MySQL服务器
  2. mysqli_real_connect():做caching_sha2身份验证:109时服务器意外响应
  3. mysqli_real_connect():(HY000 / 2006):MySQL服务器已消失

这是我接下来要做的:

确保MySQL的正确用户名和密码。 确保正确的主机名。 确保MySQL正在运行:

mysqladmin -u root -p status
Enter password: 
Uptime: 173  Threads: 2  Questions: 3  Slow queries: 0  Opens: 113  Flush tables: 3  Open tables: 35  Queries per second avg: 0.017

对PHP 7.4 ext-opcache.ini文件进行了以下更改:

opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 50000
opcache.validate_timestamps = 1
opcache.revalidate_freq = 2

对PHP 7.4 php.ini文件进行了以下更改:

expose_php = Off
max_execution_time = 90
max_input_time = 90
max_input_vars = 2000
memory_limit = -1
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
upload_max_filesize = 3G
post_max_size = 0
default_socket_timeout = 180
date.timezone = America/Chicago
pdo_mysql.default_socket = /tmp
mysqli.default_socket = /tmp/mysql.sock

安装了以下PHP 7.4扩展:

pecl channel-update pecl.php.net
pecl install apcu
pecl install imagick
pecl install redis

其他信息:

我的httpd日志未报告任何异常:

[Sat Nov 30 20:53:48.021678 2019] [mpm_prefork:notice] [pid 140] AH00163: Apache/2.4.41 (Unix) OpenSSL/1.1.1d configured -- resuming normal operations
[Sat Nov 30 20:53:48.021785 2019] [core:notice] [pid 140] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'

类似地,我的MySQL日志未报告任何异常:

2019-12-01T03:07:00.6NZ mysqld_safe Logging to '/usr/local/var/mysql/moriarty.local.err'.
2019-12-01T03:07:00.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-12-01T03:07:02.994684Z 0 [System] [MY-010116] [Server] /usr/local/opt/mysql/bin/mysqld (mysqld 8.0.18) starting as process 398
2019-12-01T03:07:03.012177Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-12-01T03:07:06.203718Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-12-01T03:07:06.277615Z 0 [System] [MY-010931] [Server] /usr/local/opt/mysql/bin/mysqld: ready for connections. Version: '8.0.18'  socket: '/tmp/mysql.sock'  port: 3306  Homebrew.
2019-12-01T03:07:06.337877Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/tmp/mysqlx.sock' bind-address: '127.0.0.1' port: 33060

1 个答案:

答案 0 :(得分:1)

这是一个错误。我会做出一个疯狂的猜测,这与将mysqlnd客户端API库版本从以前的5.0.12提升到7.4.0有关。

虽然您可以通过将default_authentication_plugin = mysql_native_password添加到 my.cnf 的{strong> LESSLESSLESS>的[mysqld]部分中来暂时将默认身份验证插件设置为本地密码安全,我建议降级php(我可以确认7.3.1版可以成功运行,也可以确认其他7.3版也可以运行),直到它被修复为止,除非您仍然使用本机密码机制。