Openssl enabled via web but disabled when using php cli


I'm using php 5.4.38 wich was compiled with open ssl (-with-openssl)

Via the web phpinfo() reads :

OpenSSL support 	enabled
OpenSSL Library Version 	OpenSSL 0.9.8o 01 Jun 2010
OpenSSL Header Version 	OpenSSL 0.9.8o 01 Jun 2010 

Open in new window

Using openssl with php cli does not work

php -i | grep ssl
OpenSSL support => disabled (install ext/openssl)

Even if I force php cli to use the web php.ini, I know that when using cli php uses a different php.ini

php -c /usr/local/php54/lib/php.ini -i | grep ssl
OpenSSL support => disabled (install ext/openssl)

I'm stuck there and when i want to download composer for php, the error message reads :
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl

Open in new window

Just for the record, here's a copy of my config for compiling php
'./configure' \
'--with-mysql=mysqlnd' \
'--with-mysqli=mysqlnd' \
'--prefix=/usr/local/php54' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-gd' \
'--enable-gd-native-ttf' \
'--with-png-dir=/lib' \
'--with-jpeg-dir=/usr/lib' \
'--with-zlib' \
'--enable-ftp' \
'--with-pdo-mysql=mysqlnd' \
'--with-mcrypt' \
'--with-freetype-dir=/usr/lib' \
'--enable-mbstring=all' \
'--with-openssl=/usr' \
'--with-curl=/usr/local/lib' \
'--enable-sockets' \
'--with-gettext=/usr/bin' \
'--enable-soap' \
'--enable-zip' \
'--with-imap=/usr/local/imap-2007f' \
'--with-libdir=lib64' \
'--with-kerberos=/usr' \

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are both installations using same php.ini file?
FFTAuthor Commented:
Hello Gheist,

there is only ONE installation, by default php cli uses a different php.ini as in any php installation (wich is a bit troubling at first)

php --ini
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         /usr/local/lib/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Open in new window

Either by using a symbolic link from /usr/local/lib/php.ini to /usr/local/php54/lib/php.ini or forcing php cli to use a specific config file (php -c /usr/local/php54/lib/php.ini) the result is the same when I try to use httpd conneciton (via curl or readfile) => OpenSSL support => disabled (install ext/openssl)

Inside the php.ini there is no option for openssl apart for the windows library to activate (extension=php_openssl.dll), wich is not relevant in this case (Debian 6)

So i'm really stuck there...
linux php will not activate windows ddl. it must be
Make Network Traffic Fast and Furious with SD-WAN

Software-defined WAN (SD-WAN) is a technology that determines the most effective way to route traffic to and from datacenter sites. Register for the webinar today to learn how your business can benefit from SD-WAN!

FFTAuthor Commented:
I know that , my current Apache 2 server uses php as an Apache module...
php_sapi_name() returns "apache2handler"

And inside the module line from phpinfo i read "Loaded Modules " : core mod_authn_file mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_include mod_filter mod_deflate mod_log_config mod_env mod_setenvif mod_version mod_proxy mod_proxy_connect mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_proxy_ajp mod_proxy_balancer mod_ssl prefork http_core mod_mime mod_status mod_autoindex mod_asis mod_info mod_suexec mod_cgi mod_negotiation mod_dir mod_actions mod_userdir mod_alias mod_rewrite mod_so mod_php5
If you used php shipped with your distribution somebody could eventually help with the issue.
Since you built PHP yourself - either help yourself or move to vendor's PHP.
FFTAuthor Commented:

well the solution was to compile php with the proper directive


Open in new window

instead of


Open in new window

This way the module is created in the php extensions folder, I had just to activate it via the php.ini  configuration file

Open in new window

Restart Apache and there you go !

# php -i | grep openssl

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FFTAuthor Commented:
As no one replied I had to search by myself...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.