As part of setting up a developer environment on OSX10.11 El Capitan I am have trying to compile php7.0.8 to make use of a freshly installed version of cURL (currently v7.49.1) instead of Apple's system install of V7.43.0 which uses SecureTransport instead of openSSL. I found a good reference which I've mostly followed here: http://mac-dev-env.patrickbougie.com/php/ . And this has kindly been updated to include a quick fix for php support of openSSL which was found not to compile without errors either! [possibly a php configure bug? TBC] cURL installs consistently without issue and overwrites the system install so can be used from the command line.
my [existing] cURL installation:
./configure
--prefix=/usr/local/curl-7.49.1
--with-ssl=/usr/local/openssl
ln -s /usr/local/curl-7.49.1 /usr/local/curl
echo 'PATH=/usr/local/curl/bin:$PATH' >> ~/.bash_profile
source ~/.bash_profile
I previously tried a usr/local prefix but this was similarly not used by php:
./configure
--prefix=/usr/local
--with-ssl=/usr/local/openssl
echo 'PATH=/usr/local/bin/curl/bin:$PATH' >> ~/.bash_profile
source ~/.bash_profile)
I've also tested this same compile sequence using php v5.6.23 sadly with the same results. php compiles without errors but the result is that php remains linked to the system cURL and not the one referenced by the configure script.
my php configure command:
./configure
--prefix=/usr/local/php-7.0.8
--with-config-file-path=/usr/local/php-7.0.8/etc
--enable-intl
--with-icu-dir=/usr/local/icu
--enable-bcmath
--enable-mbstring
--enable-sockets
--enable-zip
--with-apxs2=/usr/local/apache/bin/apxs
--with-bz2
--with-curl=/usr/local/curl
--with-freetype-dir=/usr/local/freetype
--with-gd
--with-imap-ssl
--with-jpeg-dir=/usr/local/libjpeg
--with-mcrypt=/usr/local/libmcrypt
--with-mysqli
--with-pear
--with-pdo-mysql
--with-pdo-pgsql=/usr/local/postgresql
--with-pgsql=/usr/local/postgresql
--with-png-dir=/usr/local/libpng
--with-openssl=/usr/local/openssl
--with-xmlrpc
--with-xsl
--with-zlib'
I've also tried the --with-curl option (without a directory specified) both compile without error but php still references the system cURL.
my ~/.bash_profile:
export PATH=/usr/local/curl/bin:$PATH
export PATH=/usr/local/autoconf/bin:$PATH
export PATH=/usr/local/openssl/bin:$PATH
export MANPATH=/usr/local/openssl/ssl/man:$MANPATH
export PATH=/usr/local/git/bin:$PATH
export MANPATH=/usr/local/git/share/man:$MANPATH
export PATH=/usr/local/cmake/bin:$PATH
export MANPATH=/usr/local/cmake/man:$MANPATH
export PATH=/usr/local/mysql/bin:$PATH
export MANPATH=/usr/local/mysql/man:$MANPATH
export PATH=/usr/local/memcached/bin:$PATH
export MANPATH=/usr/local/memcached/share/man:$MANPATH
export PATH=/usr/local/redis/bin:$PATH
export PATH=/usr/local/pcre/bin:$PATH
export PATH=/usr/local/apache/bin:$PATH
export MANPATH=/usr/local/apache/man:$MANPATH
export PATH=/usr/local/postgresql/bin:$PATH
export MANPATH=/usr/local/postgresql/man:$PATH
export PATH=/usr/local/php/bin:$PATH
export MANPATH=/usr/local/php/man:$MANPATH
export PATH=/usr/local/node/bin:$PATH
export MANPATH=/usr/local/node/share/man:$MANPATH
export PATH=/usr/local/graphicsmagick/bin:$PATH
export PATH=/usr/local/icu/bin:$PATH
export PATH=/usr/local/src/composer:$PATH
# which curl
finds my fresh cURL install /usr/local/curl/bin/curl
curl --version
curl 7.49.1 (x86_64-apple-darwin15.5.0) libcurl/7.49.1 OpenSSL/1.0.2h zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
The standard output of the php configure script displays my installed curl version each time (not the system version) which implies that the configure script has found my intended cURL but then compiled php ignores this?
The fix is:
After running the configure
command including the option: --with-openssl=/path/to/my_new_openssl_dir
, is to edit the php src Makefile, and remove all instances of -libcrypto
and -libssl
within the EXTRA_LIBS=
section before adding the full paths to the newly installed libcrypto & libssl libraries: /path/to/my_new_openssl_dir/lib/libssl.dylib /path/to/my_new_openssl_dir/lib/libcrypto.dylib
(making sure there is a space between them and the previous library entries).
This allowed me to compile the most recent stable php7.0.8 with OpenSSL/1.0.2h and curl 7.49.1 on OSX 10.11 El Capitan without disabling SIP to add overriding symlinks and without using HomeBrew.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.