Home Brew PHP 7.2.5使用cURL安装 [英] Home Brew PHP 7.2.5 Install with cURL

查看:99
本文介绍了Home Brew PHP 7.2.5使用cURL安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac上有一个使用自制程序php公式的localhost开发环境,并且试图通过cURL的自定义路径而不是使用默认的Mac OS版本(v7.54.0)进行安装SSL的SecureTransport. SecureTransport导致对远程服务的SSL请求出现很多问题,因此出于我的目的,OpenSSL几乎是必需的.

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

  1. 使用OpenSSL通过家庭酿造安装curl:brew install curl --with-openssl
  2. 编辑了brew的php公式以修改编译过程,告诉./configure使用brew安装的curl(v7.59.0).我试过--with-curl=/usr/local/Cellar/curl/7.59.0--with-curl=#{Formula["curl"].opt_prefix}.第二个选项只是到前者的动态符号链接.
  3. 保存修改并从源代码中重建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 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'

如果您注意到,它的末尾会有一个--with-curl尾部,而其他所有内容均按照酿造公式中定义的顺序进行.我不知道将其附加到./configure命令的位置或方式,但这可能与问题的原因有关.

作为参考,以下是Brew修改后的php.rb公式的确切内容:

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

无论哪种方式,我都完全被困在这里.非常感谢您的帮助或帮助.

解决方案

我已经应用了dossy提供的补丁,并且有效!

以下是解决该问题的具体步骤.可以在下面找到有关此修复程序的更多详细信息.

  1. cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
  2. curl -s https://github.com/dossy/homebrew-core/commit/b75fe286f79e2b89548c5ed1bbe1958313c5c103.patch | patch -p1
  3. brew reinstall 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 install php --build-from-source之后构建以下命令.如果您已经安装了PHP,则需要使用重新安装代替安装.

I have a localhost development environment on my Mac that uses homebrew's php formula and I'm pulling my hair out trying to install with a custom path to cURL rather than the default Mac OS version (v7.54.0) that uses SecureTransport for SSL. SecureTransport causes a lot of issues with SSL requests to remote services, so OpenSSL is pretty much a requirement for my purposes.

Here's the process I've taken so far:

  1. Installed curl through home brew with OpenSSL: brew install curl --with-openssl
  2. Edited brew's php formula to modify the compile process, telling ./configure to use the brew installed curl (v7.59.0). I've tried --with-curl=/usr/local/Cellar/curl/7.59.0 and also --with-curl=#{Formula["curl"].opt_prefix}. The second option is just a dynamic symlink to the former.
  3. Save the edits and rebuild php from the source: brew reinstall --build-from-source php

To verify that I have the write ./configure options I added a temporary line to my Brew formula edits that spits out the args passed. Here's what this looks like:

--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

By all intensive purposes this should be working, but when I open up a phpinfo() after reinstalling php from the source I'm seeing the following under the Configure Command value:

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

If you notice, there's a trailing --with-curl at the tail of this, while everything else is in the order that's defined in the brew formula. I have no idea where or how this is appended onto the ./configure command, but this may be related to the cause of the issue.

For reference, here's the exact content of the modified php.rb formula for Brew:

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

Either way, I'm completely stumped here. Any help or assistance is very much appreciated.

解决方案

I've applied the patch supplied by dossy and it works!

Below are the specific steps to take to solve the issue. More details on what this fixes can be found below.

  1. cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
  2. curl -s https://github.com/dossy/homebrew-core/commit/b75fe286f79e2b89548c5ed1bbe1958313c5c103.patch | patch -p1
  3. brew reinstall php --build-from-source

The specific source of issue appears to be that the libxml2 library is needed to replace Mac's built-in libcurl, which is what ultimately forces PHP's dependency on SecureTransport. These two lines in php.rb were the critical part of the fix for my purposes:

  • depends_on "libxml2"
  • --with-libxml-dir=#{Formula["libxml2"].opt_prefix}

For my specific circumstance I had to reset my editted home brew formula (php.rb) to the source because I had previously editted it. As a result applying the patch didn't work at first. If you've also editted your php.rb formula then I'd reset it to the source: https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/php.rb.

In the linked article on medium.com dossy suggests the follow command to build after applying to patch, brew install php --build-from-source. If you already have PHP installed you'll need to use reinstall in place of install instead.

这篇关于Home Brew PHP 7.2.5使用cURL安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆