微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Home Brew PHP 7.2.5使用cURL安装

我的Mac上有一个本地主机开发环境,它使用自制软件的PHP公式,我试着用cURL的自定义路径安装,而不是使用SecureTransport for SSL的认Mac OS版本(v7.54.0). SecureTransport会对远程服务的SSL请求造成很多问题,因此OpenSSL几乎是我的目的.

这是我到目前为止所采取的过程:

>使用OpenSSL通过家庭酿造安装卷曲: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重新安装–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 Command值下看到以下内容

'./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'

如果你注意到,在它的尾部有一个尾随 – 卷曲,而其他一切都是在brew公式中定义的顺序.我不知道在./configure命令中将其附加到何处或如何,但这可能与问题的原因有关.

作为参考,这里是Brew的修改后的PHP.rb公式的确切内容

https://gist.github.com/Kevinlearynet/a44ffa2107a1b6e09935766a9e46cfd4

不管怎样,我完全被这里难住了.非常感谢任何帮助或帮助.

解决方法:

我已经应用了由dossy提供的补丁,它可以工作!

以下是解决问题的具体步骤.有关此修复程序的更多详细信息,请参见下文.

> cd /usr/local/Homebrew / Library / Taps / homebrew / homebrew-core
> curl -s https://github.com/dossy/homebrew-core/commit/b75fe286f79e2b89548c5ed1bbe1958313c5c103.patch |补丁-p1
> brew重新安装PHP –build-from-source

问题的具体来源似乎是需要libxml2库来替换Mac的内置libcurl,这最终迫使PHP依赖于SecureTransport. PHP.rb中的这两行是我修复的关键部分:

> depends_on“libxml2”
> –with-libxml-dir =#{Formula [“libxml2”].opt_prefix}

对于我的具体情况,我不得不将我的编辑家酿啤酒配方(PHP.rb)重置为源,因为我之前编辑过它.因此,应用补丁最初不起作用.如果您还编辑了PHP.rb公式,那么我将其重置为源:https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/php.rb.

在medium.com上的链接文章中,dossy建议在应用于补丁之后构建以下命令,brew安装PHP –build-from-source.如果您已安装PHP,则需要使用重新安装代替安装.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐