Sometimes, while running PHP websites, you may get an error “Unable to find socket transport SSL…” message. It relates to HTTPS/SSL web pages and openssl library. In this article, we will look at how to fix this problem.
How to Fix “Unable to find socket transport SSL” error in PHP
It is easy to fix this problem. Just open php.ini file in a text editor.
$ sudo vi /etc/php/x.y/apache2/php.ini
In above command, x.y is the version of your PHP, for example, 5.6, 5.7, etc. In windows, php.ini is generally located at C:\PHP\php.ini.
In both cases (LInux or Windows), if you are unable to find php.ini file, then just create a simple php file (php_info.php) with the following code and save it at the root folder of your website (/var/www/html/php_info.php)
<?php phpinfo(); ?>
Open web browser and go to http://localhost/php_info.php. You will see an output as shown below.
Scroll down to “Loaded Configuration File” value. It will give you the location of php.ini file.
Look for the following line.
Uncomment it by removing ; at its beginning.
Also ensure that php_openssl.dll is in one of the folders in Linux PATH variable so that it is easily found. You can easily view the PATH value with following command.
$ echo $PATH
If you are on windows, then copy php_openssl.dll file to C:\windows or C:\windows\system32 where it can be found easily by the system.
That’s it. We have learnt how to fix “Unable to find socket transport SSL” error in PHP.