Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im trying to recompile PHP, but ./configure fails at :

configure: error: Cannot find OpenSSL's <evp.h>

I have LibSSL 1.0.0, LibSSL 0.9.8, LibSSL-Dev, OpenSSL installed.

--with-openssl=/usr/include/openssl

when I try with

--with-openssl

tells me:

configure: error: Cannot find OpenSSL's libraries

Where the ** are the problem ?

P.S. Php is 5.2.5, OS is Ubuntu

share|improve this question

I had the same problem in Ubuntu 12.04.1 LTS and solved it with:

sudo apt-get install libcurl4-openssl-dev pkg-config.

After that I could compile it just using --with-openssl

share|improve this answer
    
Hello :) I forgot how do I solve my problem. :) It was a half year ago. – CappY Mar 2 '13 at 21:55

To build php-5.3 on Debian wheezy you need the following to fix this error.

    apt-get install libssl-dev libsslcommon2-dev

Then you need to configure with the following included

    ./configure --with-libdir=/lib/x86_64-linux-gnu ...
share|improve this answer
1  
1+, helped me a lot. I also had to add --with-php-config /usr/local/src/php-x.x.x/scripts/php_config. I have written a how-to compile PHP with extensions. – DanFromGermany Feb 16 '15 at 22:27
    
works but fails all test cases. – Rafael Jul 29 '15 at 4:13
    
Works to for PHP5.2 manual compile on Ubuntu 14.04 with "--with-openssl" directive. thanks a lot. – Dr I Aug 3 '15 at 14:54

Another reason ./configure might fail is because you don't have pkg-config installed, like in my case with PHP7 and Debian Jessie:

sudo apt-get install pkg-config

share|improve this answer
1  
That was already pointed out in a different answer from three years ago. – kasperd Nov 4 '15 at 10:41
    
Did the trick. Thanks. – Sinan Eldem Jan 19 at 21:13

Assuming that you already have the OpenSSL libraries and header files (on rpm systems the latter are in the xxxx-devel package)...

The issue seems to arise from how configure resolves dependencies which are distributed around the filesystem. To compile the code, the comiler needs to know where the headers are. To link the code, the linker needs to know where the libraries are.

[colin@host]$ configure .... --with-openssl-dir=/usr/include/openssl ....
...
checking OpenSSL dir for FTP... /usr/include/openssl
checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>

[colin@host]$ find /usr/include -name evp.h
/usr/include/openssl/evp.h

The include directory has the include file, but pkg-config fails because the library is not in /usr/include/openssl, its in /usr/lib

Running configure again with /usr as the directory:

configure .... --with-openssl-dir=/usr/include/openssl ....
...
checking OpenSSL dir for FTP... /usr
checking for pkg-config... /usr/bin/pkg-config
checking for OpenSSL version... >= 0.9.6
checking for CRYPTO_free in -lcrypto... yes
...

The path passed as an argument is searched to find the relevant resources.

share|improve this answer
    
This worked for me. This is a good solution. – Shawn Welch Oct 15 '15 at 5:50

To compile php-5.4.45 on debian 8.1 (Jessie) i had to:

apt-get install libssl-dev

After that I could compile it just using --with-openssl

share|improve this answer

You need to help configure figuring out where to look for the evp.h file, because by default it will scan for directories and add hardcoded suffixes to them to find it. I've kept the details in my wiki page for those who want to understand the solution. Here's what worked for me :

root@audio-mon[10.10.10.82] ~/DOWNLOADS/php-5.5.23/ext/mysqlnd # PHP_OPENSSL_DIR="/usr /usr/lib/x86_64-linux-gnu"
root@audio-mon[10.10.10.82] ~/DOWNLOADS/php-5.5.23/ext/mysqlnd # ./configure --with-libdir=""
[...]
checking for DSA_get_default_method in -lssl... yes
checking for X509_free in -lcrypto... yes
checking for pkg-config... /usr/bin/pkg-config
checking for OpenSSL version... >= 0.9.6 #                     <------------------------------------- YES !
[...]
config.status: creating config.h
config.status: config.h is unchanged
root@audio-mon[10.10.10.82] ~/DOWNLOADS/php-5.5.23/ext/mysqlnd # 

YMMV (paths are different). If that didn't work for you check the wiki page, it will help you figure out what paths to put.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.