2014-11-23 121 views
5

我已經安裝了OpenSSL 1.0.1j至/usr/local/ssl,現在我正在嘗試使用此版本的OpenSSL編譯PHP 5.5.19。下面是我的步驟進行配置...如何在OS X上使用OpenSSL 1.0.1編譯PHP 5.5.19

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 

的配置過程似乎正常工作,但是當我運行make,我得到這個:

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 

如果我運行相同的配置選項,但點的OpenSSL的系統版本的/ usr

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

然後使運行沒有問題,PHP的安裝罰款,但與舊版本的OpenSSL。我怎樣才能使用我的新版本的OpenSSL?

回答

2

的Makefile中有EXTRA_LIBS一條線,像這樣:

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

去除-lssl所有事件和-lcrypto並添加完整路徑libssl.dyliblibcrypto.dylib

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

兩件事情,首先如果你在apache上使用php,使用openssl進行編譯和安裝apr-util可能更重要。但是,如果你只是想有PHP與你的自定義生成OpenSSL的工作,你可以用下面的步驟做:

1)假設你有建造和安裝在您的OpenSSL:

/opt/install2015/openssl-1.0.1p/ 

2)設置你的環境變種:

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 

我有兩個系統,其中一個只適用於PATH env var set。在另一個較老的系統上,我需要設置LD_x變量以使其工作。

3)PHP配置可以只是:

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

之後,運行配置腳本,make和make install。

+0

PATH應設置爲:PATH =/opt/install2015/openssl-1.0.1p/bin:$ PATH – 2015-08-29 18:37:23