Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using Centos 6.2 and PHP 5.3.9.

I am trying to build PHP with OpenSSL extension in order for me to be able to use PEAR Mail/SMTP over SSL.

During configuration of PHP I get this in the error_log (for both options mentioned below):

checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL's <evp.h>

This is my ./config

./configure --enable-intl --with-gettext --with-gettext=/usr/sbin --with-apxs2=/usr/sbin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-imap=/path/to/imap_src --with-libdir=lib --with-kerberos --with-imap-ssl --with-openssl=/usr/lib/openssl

As option 2 I have also tried with --with-openssl=/usr/include/openssl

None is working and that's a bit strange since evp.h is located in /usr/include/openssl

When using --with-openssl=shared I get this at start-up of apache/httpd (no errors upon making php)

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/openssl.se' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/openssl.se: cannot open shared object file: No such file or directory in Unknown on line 0

This is the error message from PEAR Mail (this is for successfull making using --with-openssl= shared):

Failed to connect to ssl://mail.smicloud.se:465 [SMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )] niklas@iandapp.com

I don't post my php-code since I am positive the problem is related to the system setup.

I have searched around a lot and tried the most things I found. Following are just a couple of examples:

yum install openssl-devel
yum install libcurl-devel

"yum list installed | grep openssl" gives

openssl.i686                         1.0.0-20.el6_2.2          @updates         
openssl-devel.i686                   1.0.0-20.el6_2.2          @updates  

Any suggestions for how to solve it or how to find additional information about the setup that will help me understand the problem better?

I'm a newbie working with these kind of things. If there is a better way of downloading and compiling needed extensions I would be more than happy to know. The reason why I do like this is simply because I don't know any other way. Can it be done just using yum?

share|improve this question
Do you really need php 5.3.9 as opposed to the php that ships with CentOS? Because compiling and maintaining your own php: that way leads to madness. –  cjc Mar 12 '12 at 14:25
The reason why I started doing that was because I needed modules that weren't installed. If there is a better way of adding those modules I am more than happy to learn (newbie as mentioned...). So far I have solved it for all other (4-5 modules), but this one got me stuck. –  Nicsoft Mar 12 '12 at 14:32
Ideally, you want to keep everything in package management. If you need packages that aren't in the standard repositories, look for them in additional repos. Take a look at wiki.centos.org/AdditionalResources/Repositories and add in EPEL, at a minimum. Then do "yum search php" to see what's available. If you can't find what you need at that point, start looking at just building the modules from PECL. –  cjc Mar 12 '12 at 14:45
You don't need a clean CentOS install to add those repos. You can just start using them. Primarily, they are additional packages, not replacement packages (unless clearly specified). I would, however, remove the self-compiled stuff you might have lying around. –  cjc Mar 12 '12 at 15:16
No, you should enable EPEL (and RPMForge) from the instructions on the CentOS page, and then start doing "yum search" for the bits that you might need. You don't need to remove your LAMP setup, if you've installed Apache and MySQL through packages. CentOS ships with an adequate LAMP stack. –  cjc Mar 12 '12 at 15:28
show 9 more comments

Your Answer


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

Browse other questions tagged or ask your own question.