【发布时间】:2018-10-19 22:57:42
【问题描述】:
我的 Mac 上有一个 localhost 开发环境,它使用自制软件的 php 公式,我正在努力尝试使用 cURL 的自定义路径安装,而不是使用默认的 Mac OS 版本 (v7.54.0) SSL 的安全传输。 SecureTransport 导致对远程服务的 SSL 请求出现很多问题,因此 OpenSSL 几乎是我的要求。
这是我到目前为止所采取的过程:
- 使用 OpenSSL 通过 home brew 安装 curl:
brew install curl --with-openssl - 编辑brew的
php公式修改编译过程,告诉./configure使用brew安装的curl(v7.59.0)。我试过--with-curl=/usr/local/Cellar/curl/7.59.0和--with-curl=#{Formula["curl"].opt_prefix}。第二个选项只是前者的动态符号链接。 - 保存编辑并从源代码重建 php:
brew reinstall --build-from-source php
为了验证我是否有写入 ./configure 选项,我在我的 Brew 公式编辑中添加了一个临时行,该行会吐出通过的 args。如下所示:
--prefix=/usr/local/Cellar/php/7.2.5
--localstatedir=/usr/local/var
--sysconfdir=/usr/local/etc/php/7.2
--with-config-file-path=/usr/local/etc/php/7.2
--with-config-file-scan-dir=/usr/local/etc/php/7.2/conf.d
--with-pear=/usr/local/Cellar/php/7.2.5/share/php/pear
--enable-bcmath
--enable-calendar
--enable-dba
--enable-dtrace
--enable-exif
--enable-ftp
--enable-fpm
--enable-intl
--enable-mbregex
--enable-mbstring
--enable-mysqlnd
--enable-opcache-file
--enable-pcntl
--enable-phpdbg
--enable-phpdbg-webhelper
--enable-shmop
--enable-soap
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-wddx
--enable-zip
--with-apxs2=/usr/local/opt/httpd/bin/apxs
--with-bz2
--with-curl=/usr/local/Cellar/curl/7.59.0
--with-fpm-user=_www
--with-fpm-group=_www
--with-freetype-dir=/usr/local/opt/freetype
--with-gd
--with-gettext=/usr/local/opt/gettext
--with-gmp=/usr/local/opt/gmp
--with-icu-dir=/usr/local/opt/icu4c
--with-jpeg-dir=/usr/local/opt/jpeg
--with-kerberos
--with-layout=GNU
--with-ldap
--with-ldap-sasl
--with-libedit
--with-libzip
--with-mhash
--with-mysql-sock=/tmp/mysql.sock
--with-mysqli=mysqlnd
--with-ndbm
--with-openssl=/usr/local/opt/openssl
--with-password-argon2=/usr/local/opt/argon2
--with-pdo-dblib=/usr/local/opt/freetds
--with-pdo-mysql=mysqlnd
--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc
--with-pdo-pgsql=/usr/local/opt/libpq
--with-pgsql=/usr/local/opt/libpq
--with-pic
--with-png-dir=/usr/local/opt/libpng
--with-pspell=/usr/local/opt/aspell
--with-sodium=/usr/local/opt/libsodium
--with-unixODBC=/usr/local/opt/unixodbc
--with-webp-dir=/usr/local/opt/webp
--with-xmlrpc
--with-xsl
--with-zlib
出于所有密集目的,这应该工作,但是当我从源重新安装php后打开phpinfo()时,我在配置命令下看到以下内容> 价值:
'./configure'
'--prefix=/usr/local/Cellar/php/7.2.5'
'--localstatedir=/usr/local/var'
'--sysconfdir=/usr/local/etc/php/7.2'
'--with-config-file-path=/usr/local/etc/php/7.2'
'--with-config-file-scan-dir=/usr/local/etc/php/7.2/conf.d'
'--with-pear=/usr/local/Cellar/php/7.2.5/share/php/pear'
'--enable-bcmath'
'--enable-calendar'
'--enable-dba'
'--enable-dtrace'
'--enable-exif'
'--enable-ftp'
'--enable-fpm'
'--enable-intl'
'--enable-mbregex'
'--enable-mbstring'
'--enable-mysqlnd'
'--enable-opcache-file'
'--enable-pcntl'
'--enable-phpdbg'
'--enable-phpdbg-webhelper'
'--enable-shmop'
'--enable-soap'
'--enable-sockets'
'--enable-sysvmsg'
'--enable-sysvsem'
'--enable-sysvshm'
'--enable-wddx'
'--enable-zip'
'--with-apxs2=/usr/local/opt/httpd/bin/apxs'
'--with-bz2'
'--with-fpm-user=_www'
'--with-fpm-group=_www'
'--with-freetype-dir=/usr/local/opt/freetype'
'--with-gd'
'--with-gettext=/usr/local/opt/gettext'
'--with-gmp=/usr/local/opt/gmp'
'--with-icu-dir=/usr/local/opt/icu4c'
'--with-jpeg-dir=/usr/local/opt/jpeg'
'--with-kerberos'
'--with-layout=GNU'
'--with-ldap'
'--with-ldap-sasl'
'--with-libedit'
'--with-libzip'
'--with-mhash'
'--with-mysql-sock=/tmp/mysql.sock'
'--with-mysqli=mysqlnd'
'--with-ndbm'
'--with-openssl=/usr/local/opt/openssl'
'--with-password-argon2=/usr/local/opt/argon2'
'--with-pdo-dblib=/usr/local/opt/freetds'
'--with-pdo-mysql=mysqlnd'
'--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc'
'--with-pdo-pgsql=/usr/local/opt/libpq'
'--with-pgsql=/usr/local/opt/libpq'
'--with-pic'
'--with-png-dir=/usr/local/opt/libpng'
'--with-pspell=/usr/local/opt/aspell'
'--with-sodium=/usr/local/opt/libsodium'
'--with-unixODBC=/usr/local/opt/unixodbc'
'--with-webp-dir=/usr/local/opt/webp'
'--with-xmlrpc'
'--with-xsl'
'--with-zlib'
'--with-curl'
如果您注意到,在其尾部有一个尾随 --with-curl,而其他所有内容都按照 brew 公式中定义的顺序。我不知道它在哪里或如何附加到 ./configure 命令中,但这可能与问题的原因有关。
作为参考,这里是修改后的 Brew 公式 php.rb 的确切内容:
https://gist.github.com/Kevinlearynet/a44ffa2107a1b6e09935766a9e46cfd4
不管怎样,我完全被难住了。非常感谢任何帮助或帮助。
【问题讨论】:
-
不确定它是否适合您的需求,但您是否尝试过安装 php
—with-homebrew-curl? -
brew install php现在是 homebrew-core 的一部分,该命令实际上已被删除,并且是这里问题的主要原因。以前当我安装了brew install php72时,这是我采用的方法,但遗憾的是它不再可能了。 -
与此处相关的另一条注释,我使用
brew edit php所做的编辑实际上是基于--with-homebrew-curl在公式内部的更改基于此:github.com/Homebrew/homebrew-php/blob/… -
在 linux 中,问题是相同的。每个 7 版本都有自己的文件夹。您应该能够使用通配符搜索所有可用的槽:
apt list php7*或类似的 brew。 -
@Cryptopat 这并没有提供与我概述的问题相关的任何价值。我可以运行
brew list | grep php来执行此操作,但我得到的正是我所期望和想要看到的。问题是如何编译那个版本的 PHP。