How to compile PHP 5.5.19 with OpenSSL 1.0.1 on OS X

I installed OpenSSL 1.0.1j in /usr/local/ssl and now I am trying to compile PHP 5.5.19 using this version of OpenSSL. Here is my setup procedure ...

 export CFLAGS="-arch x86_64" export CXXFLAGS="-arch x86_64" export LDFLAGS="-L/usr/local/ssl/lib" export CPPFLAGS="-I/usr/local/ssl/include" ./configure \ --prefix=/usr/local/php5 \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --sysconfdir=/etc \ --with-config-file-path=/etc \ --with-zlib \ --with-zlib-dir=/usr \ --with-apxs2=/usr/sbin/apxs \ --with-openssl=/usr/local/ssl \ --without-iconv \ --enable-cli \ --enable-exif \ --enable-ftp \ --enable-mbstring \ --enable-mbregex \ --enable-sockets \ --with-mysql=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-gd \ --with-jpeg-dir=/usr/local/lib \ --with-png-dir=/usr/X11R6 \ --with-freetype-dir=/usr/X11R6 \ --with-xpm-dir=/usr/X11R6 \ --with-mcrypt \ --with-curl 

The setup process works fine, but when I run make, I get the following:

 Undefined symbols for architecture x86_64: "_PKCS5_PBKDF2_HMAC", referenced from: _zif_openssl_pbkdf2 in openssl.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [libs/libphp5.bundle] Error 1 

If I run the same configuration options, but point openssl for the system version / usr

 ... --with-openssl=/usr ... 

Then do the runs without problems, and php will install fine, but with the old version of OpenSSL. How can I get it to use my new version of OpenSSL?

+5
source share
2 answers

There is a line with EXTRA_LIBS in the EXTRA_LIBS , something like:

 EXTRA_LIBS = -lresolv -lmcrypt -lltdl -liconv-lm -lxml2 -lcurl -lssl -lcrypto 

Remove all occurrences of -lssl and -lcrypto and add the full path to libssl.dylib and libcrypto.dylib

 EXTRA_LIBS = -lresolv -lmcrypt /usr/local/ssl/lib/libssl.dylib /usr/local/ssl/lib/libcrypto.dylib -lltdl -liconv-lm -lxml2 -lcurl 
+2
source

Two things, first of all, if you are using php with apache, it is probably more important to compile and install apr-util with openssl configuration. But if you just want php to work with your openssl build, you can do it with the following steps:

1) Suppose you created and installed your openssl in:

 /opt/install2015/openssl-1.0.1p/ 

2) install your env var:

 LD_LIBRARY_PATH=/opt/install2015/openssl-1.0.1p/lib/ PATH=/opt/install2015/openssl-1.0.1p/bin LD_RUN_PATH=/opt/install2015/openssl-1.0.1p/lib 

I have two systems, one of which only works with the PATH env var set. On another old system, I need LD_x vars to be installed to make it work.

3) Your php configuration can only be:

 ./configure \ --with-openssl \ ... 

After that run configure script, execute and do the installation.

+1
source

Source: https://habr.com/ru/post/1207545/


All Articles