PHP Problems "The openssl extension is required for SSL/TLS protection but is not available"

Hello there. please, could someone help me out on how to fix this problem? I’m using a CentOS server (Plesk based) and if I run via SSH the following command I get the following error. Thanks for any advice. :slight_smile:

:~# composer require auth0/auth0-php:"~7.0"
Do not run Composer as root/super user! See https://getcomposer.org/root for details


  [Composer\Exception\NoSslException]
  The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error, at yo
  ur own risk, by setting the 'disable-tls' option to true.


require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

I already did everything I found on the internet but couldn’t get past this error. I have rebooted the server after adding to the PHP ini file the extension and checked if it was compiled with SSL which it “seems” to have. At least when I check on the Plesk panel I can’t find the option to add/remove, who knows. I’m still a bit raw when it comes to CentOS stuff.

Cheers, WilliamK

Hey @williamkalfelz :wave: Not super familiar with CentOS myself, either. What do you see when you run php -i | grep openssl from the shell?

1 Like

Thanks. :slight_smile:

# php -i | grep openssl
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/plesk/php/7.1/lib64/php/modules/php_openssl' - /opt/plesk/php/7.1/lib64/php/modules/php_openssl: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/plesk/php/7.1/lib64/php/modules/php_openssl.so' - /opt/plesk/php/7.1/lib64/php/modules/php_openssl.so: cannot open shared object file: No such file or directory in Unknown on line 0
Configure Command =>  './configure'  '--docdir=/opt/plesk/php/7.1/share/doc' '--infodir=/opt/plesk/php/7.1/share/info' '--localedir=/opt/plesk/php/7.1/share/locale' '--exec-prefix=/opt/plesk/php/7.1' '--sysconfdir=/opt/plesk/php/7.1/etc' '--includedir=/opt/plesk/php/7.1/include' '--prefix=/opt/plesk/php/7.1' '--libdir=/opt/plesk/php/7.1/lib64' '--sbindir=/opt/plesk/php/7.1/sbin' '--datadir=/opt/plesk/php/7.1/share' '--sharedstatedir=/opt/plesk/php/7.1/com' '--libexecdir=/opt/plesk/php/7.1/lib64' '--mandir=/opt/plesk/php/7.1/share/man' '--bindir=/opt/plesk/php/7.1/bin' '--localstatedir=/opt/plesk/php/7.1/var' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--disable-debug' '--disable-rpath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-phpdbg' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-xml' '--with-bz2' '--with-config-file-path=/opt/plesk/php/7.1/etc' '--with-config-file-scan-dir=/opt/plesk/php/7.1/etc/php.d' '--with-enchant=shared,/usr' '--with-gettext' '--with-gmp' '--with-iconv' '--with-kerberos' '--with-layout=GNU' '--with-libdir=lib64' '--with-libxml-dir=/usr' '--with-litespeed' '--with-openssl' '--with-pcre-regex' '--with-pic' '--with-system-tzdata' '--with-zlib' '--without-gdbm' '--without-pear' '--enable-bcmath=shared' '--enable-dba=shared' '--enable-dom=shared' '--enable-fileinfo=shared' '--enable-intl=shared' '--enable-json=shared' '--enable-mbregex' '--enable-mbstring=shared' '--enable-mysqlnd=shared' '--enable-pcntl' '--enable-pdo=shared' '--enable-phar=shared' '--enable-posix=shared' '--enable-soap=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-zip=shared' '--with-curl=shared,/usr' '--with-db4=/usr' '--with-freetype-dir=/usr' '--with-gd=shared' '--with-icu-dir=/usr' '--with-imap=shared' '--with-imap-ssl' '--with-jpeg-dir=/usr' '--with-ldap=shared' '--with-ldap-sasl' '--with-libedit' '--with-mcrypt=shared,/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=shared,mysqlnd' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/usr' '--with-pgsql=shared' '--with-png-dir=/usr' '--with-pspell=shared' '--with-snmp=shared,/usr' '--with-sqlite3=shared' '--with-tidy=shared,/usr' '--with-unixODBC=shared,/usr' '--with-xmlrpc=shared' '--with-xpm-dir=/usr' '--with-xsl=shared,/usr' '--without-readline' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fno-strict-aliasing -pipe -Wno-unused-function' 'CPPFLAGS=' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'
openssl
Openssl default config => /etc/pki/tls/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value

Ah, now I see, it’s failing to find the directives. I’m setting up a new server from zero and will try on that one instead. Should be in around 2 hours or maybe tomorrow.

Cheers

1 Like

Ok, finally got PHP 7.2 working, now I just need to figure out how to install composer.

Here’s what I did:

The below didn’t work:

./update_chroot.sh --add dash

So I did instead:

./update_chroot.sh --add /opt/plesk/php/7.2/bin/php

Now I need to check composer and how to add it…

Cheers

Ok, now this:

But when I try:

composer require auth0/auth0-php:"~7.2"

I get:

Fatal error: Uncaught Error: Class ‘Phar’ not found in /usr/lib64/plesk-9.0/composer.phar:23
Stack trace:
#0 {main}
thrown in /usr/lib64/plesk-9.0/composer.phar on line 23

Hmm, there’s definitely an issue with the Composer install. :thinking: This is a very nonstandard Composer install method from the look of it, but I’m not familiar with Plesk. What do you get when you just run composer install?

1 Like

Thanks :slight_smile:

bash-4.2$ composer

Fatal error: Uncaught Error: Class 'Phar' not found in /usr/lib64/plesk-9.0/composer.phar:23
Stack trace:
#0 {main}
  thrown in /usr/lib64/plesk-9.0/composer.phar on line 23

Of course in the root user it works, but the PHP version is 5.2 and I can’t seem to change it. :frowning: So I created another user where I’m trying to set things up.

Do you have access to something like this through Plesk? https://support.plesk.com/hc/en-us/articles/115002681053-How-to-change-PHP-version-for-a-domain-in-Plesk-

Unfortunately, the SDK only supports 7.3+, and 7.4+ with the next release

1 Like

Yes, thanks, already did that, and sadly I can only see 7.2 now, 7.3 is no longer there. It was yesterday. I will see if I find something…

1 Like

Let us know your other questions down the road