0

I have ubuntu 14.04., php 7 and nginx.

I want to use mysql ssl so I have enabled by removing ";" in front of extension=php_openssl.dll in

/etc/php/7.0/fpm/php.ini 
/etc/php/7.0/cli/php.ini

Restarted php and nginx services. Now I'm getting error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_openssl.dll' - /usr/lib/php/20151012/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0

File "/usr/lib/php/20151012/php_openssl.dll" really does not exist.

Php script with which I'm trying to connect on mysql ssl:

$con=mysqli_init();
if (!$con){
    die("mysqli_init failed");
}

mysqli_ssl_set($con, "/var/www/certs/client-key.pem","/var/www/certs/client-cert.pem","/var/www/certs/ca-cert.pem",NULL, null);

if (!mysqli_real_connect(
    $con,"localhost","user", 'password',"db", 3306)){
    die("Connect Error: " . mysqli_connect_error());
}
mysqli_close($con);

Permissions on all cert files are ok, tried wit 644, 664, 777.

Tried to execute script over browser and over console.

Where I can find missing package?

Thank you

UPDATE 1: If I comment back "extension=php_openssl.dll" in php.ini files then I get another error:

PHP Warning:  mysqli_real_connect(): this stream does not support SSL/crypto in /var/www/tmp.php on line 70

phpinfo: enter image description here

3
  • OpenSSL should be enabled by default in the Linux version of PHP (as long as you have OpenSSL installed on your system), so in theory all you need to do is bring back the comment to that line. You can make sure that you have OpenSSL enabled by looking at the output of phpinfo();As for the other stuff - try checking the php, mysql and nginx error logs for any more info on why you can't connect. Commented Jul 18, 2016 at 12:02
  • @SledgeHammer - updated my answer. If I do that then I get another error
    – iWizard
    Commented Jul 18, 2016 at 12:11
  • @SledgeHammer - found solution. If you are using mysql ssl do not use localhost, use server IP address
    – iWizard
    Commented Jul 18, 2016 at 12:49

2 Answers 2

3

Dynamic link libraries (DLLs) are a Windows-specific technology and don't work on Ubuntu. Because PHP can be run on different operating systems, its configuration files contain examples for how to configure it on different operating systems:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so

Normally, the Linux build of PHP already comes with SSL support built in, in contrast to the Windows build, where you need the DLL you mentioned. But you seem to use a third-party build of PHP 7 (maybe a from PPA?), because Ubuntu 14.04 comes with PHP 5 by default. So this third-party build might handle SSL differently.

2
  • Cannot find packege
    – iWizard
    Commented Jul 18, 2016 at 12:31
  • Found solution. If you are using mysql ssl do not use localhost, use server IP address
    – iWizard
    Commented Jul 18, 2016 at 12:49
0

If you are using mysql ssl do not use localhost, use server IP address for database host.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .