PHP compilation on 64-bit systems cannot find library files

Source: Internet
Author: User
Tags openssl library
64-bit system compiling PHP can not find the library file problem in 64-bit system recently compiled 5.4.5 version of PHP, encountered the following error: checkingforDSA_get_default_methodin-lssl... yescheckingforX509_freein-lcrypto... yescheckingforpkg-config... the library file cannot be found when PHP is compiled in a 64-bit usrbi system.

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.