Reputation: 53
I've installed OpenSSL 1.0.1j to /usr/local/ssl
and now I'm trying to compile PHP 5.5.19 using this version of OpenSSL. Here is my procedure to configure...
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 configure process appears to work fine, but when I run make, I get this:
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 configure options, but point openssl to the system version /usr
...
--with-openssl=/usr
...
Then make runs without a problem and php installs fine, but with an old version of OpenSSL. How can I get it to use my newer version of OpenSSL?
Upvotes: 5
Views: 2223
Reputation: 11
Two things, first all of all, if you are using php with apache, it is probably more important to compile and install apr-util with openssl configured. But if you just want to have php to work with your custom build openssl, you may do it with the following steps:
1) Assume you have build and installed your openssl in:
/opt/install2015/openssl-1.0.1p/
2) set 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 them works with just the PATH env var set. On the other older system, I need to have the LD_x vars set too to get it to work.
3) Your php configuration can just be:
./configure \
--with-openssl \
...
After that, run the configure script, make and make install.
Upvotes: 1
Reputation: 29897
The Makefile has a line with 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
Upvotes: 2