When I recently compiled PHP version 5.4.5 on a 64-bit system, the following error was reported:
checking for DSA_get_default_method in -lssl... yeschecking for X509_free in -lcrypto... yeschecking for pkg-config... /usr/bin/pkg-configconfigure: error: Cannot find OpenSSL's libraries
The specified compilation parameters are as follows:
./configure \--prefix=/usr/local/services/php-5.4.5 \--with-config-file-path=/usr/local/services/php-5.4.5/etc \--enable-fpm \--enable-mbstring \--enable-soap \--enable-sockets \--enable-zip \--with-curl=/usr \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-gd \--with-jpeg-dir=/usr \--with-png-dir=/usr \--with-zlib-dir=/usr \--with-freetype-dir=/usr \--with-openssl=/usr
I couldn't find the OpenSSL library file, but I obviously installed OpenSSL-devel. It was strange that I searched the internet and found many friends who encountered the same problem, some people say that -- with-OpenSSL can be solved without specifying a path. After a try, the compilation is successful but cannot be understood. Why? Later, I searched some articles to find out the root cause: the installed system is 64-bit, And the 64-bit user library file is/usr/lib64 by default, during compilation, -- With-libdir = lib64 is not specified, while the default compiling script is Lib, which of course cannot be found.
Change the compilation parameter:
./configure \--prefix=/usr/local/services/php-5.4.5 \--with-config-file-path=/usr/local/services/php-5.4.5/etc \--enable-fpm \--enable-mbstring \--enable-soap \--enable-sockets \--enable-zip \--with-curl=/usr \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-gd \--with-jpeg-dir=/usr \--with-png-dir=/usr \--with-zlib-dir=/usr \--with-freetype-dir=/usr \--with-openssl=/usr \--with-libdir=lib64
Solve the problem.