我在我的Mac上有一个本地主机开发环境,它使用的是自制的php
公式,而我正在竭尽全力地尝试安装到cURL的自定义路径,而不是使用SecureTransport for SSL的默认Mac版本(v7.54.0)。SecureTransport会导致很多关于远程服务的SSL请求的问题,所以OpenSSL对于我的目的来说是非常必要的。
以下是我到目前为止所采用的过程:
brew install curl --with-openssl
php
brew的php
公式修改编译过程,告知./configure
使用brew安装的curl (v7.59.0)。我尝试过--with-curl=/usr/local/Cellar/curl/7.59.0
和--with-curl=#{Formula["curl"].opt_prefix}
。第二个选项只是一个指向前者的动态符号链接。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
不管怎样,我在这里完全被难住了。任何帮助或帮助都是非常感谢的。
发布于 2018-06-11 03:48:25
我已经应用了档案提供的补丁,并且它工作了!
以下是解决该问题的具体步骤。有关此修复的更多详细信息,请参阅下面的内容。
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
curl -s https://github.com/dossy/homebrew-core/commit/b75fe286f79e2b89548c5ed1bbe1958313c5c103.patch | patch -p1
brew reinstall php --build-from-source
问题的具体来源似乎是,需要用PHP库来替换Mac的内置SecureTransport.,这最终迫使libxml2
依赖于libcurl
。就我的目的而言,php.rb中的这两行是修复的关键部分:
"libxml2"
的
对于我的特定情况,我必须将编辑后的自制brew公式(php.rb)重置为源代码,因为我之前已经对其进行了编辑。因此,应用补丁在一开始并不起作用。如果您还编辑了您的php.rb公式,那么我会将其重置为源:https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/php.rb。
在medium.com档案上的链接文章中,建议在应用补丁brew install php --build-from-source
之后构建以下命令。如果你已经安装了PHP,你需要使用reinstall来代替install。
https://stackoverflow.com/questions/50259893
复制相似问题