PHP - Unable to find the socket transport "ssl"

Viewed 2553

System Info

  • Win 10 Pro x64
  • PHP 7.3.10 x64 TS
  • HTTPD 2.4.34

I've followed this guide to generate the necessary key and certificate files.

How do I allow HTTPS for Apache on localhost?

httpd.conf

LoadModule ssl_module modules/mod_ssl.so

extra/vhosts.conf

<IfModule ssl_module>
    <VirtualHost _default_:443>
        SSLEngine on
        SSLCertificateFile "${CONF_PATH}/certs/localhost.cert"
        SSLCertificateKeyFile "${CONF_PATH}/certs/localhost.key"

        ...
    </VirtualHost>
</IfModule>

php.ini

extension=openssl

[curl]
curl.cainfo="C:\bin\httpd\conf\certs\localhost.cert"

[openssl]
openssl.cafile="C:\bin\httpd\conf\certs\localhost.cert"

This is usually where people will say to copy libeay32 and ssleay32 but, just to document this for anyone else, these are no longer the files included with recent builds. They are libcrypto and libssh now. I copied those into the Apache bin directory.

Going to a page with phpinfo() confirms these settings, with SSL marked as enabled.

Let's do some HTTPS requests.

pecl update-channels
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Channel "pear.php.net" is not responding over http://, failed with message: Connection to `ssl://pear.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
Trying channel "pear.php.net" over https:// instead
Cannot retrieve channel.xml for channel "pear.php.net" (Connection to `ssl://pear.php.net:443' failed: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date

Well, that's no good. I saw some suggestions about removing an -n flag from the PECL script. So I did that. Let's see if it's any different now.

pecl update-channels
Updating channel "doc.php.net"
Channel "doc.php.net" is up to date
Updating channel "pear.php.net"
Channel "pear.php.net" is not responding over http://, failed with message: Connection to `ssl://pear.php.net:443' failed:
Trying channel "pear.php.net" over https:// instead
Cannot retrieve channel.xml for channel "pear.php.net" (Connection to `ssl://pear.php.net:443' failed: )
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date

No, that's actually worse. Now there's just less detail about why it's failing.

Anyone have any extra insight I'm missing here on why I'm not having any success?

2 Answers

Your HTTPD php.ini (which you have checked with "Going to a page with phpinfo()") might be a different file than your pecl (command line) php.ini. Make sure that pecl is using a php.ini with openssl enabled. See pecl config-show, also https://stackoverflow.com/a/49623714/68939 .

I managed to get it to work by editing pecl.bat. Before it had this:

"%PHP_PEAR_PHP_BIN%" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9

I changed it to:

"%PHP_PEAR_PHP_BIN%" -c "%PHP_PEAR_BIN_DIR%\php.ini" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9

In other words, I added this part:

-c "%PHP_PEAR_BIN_DIR%\php.ini"

It's the same advice given here.

UPDATE

After this I got a new error:

Fatal error: Cannot use result of built-in function in write context in C:\xampp\php\pear\Archive\Tar.php on line 639

So I went and edited Tar.php and changed this:

$v_att_list = & func_get_args();

To this:

$v_att_list = func_get_args();

Seems to have gotten me further, but now I get:

ERROR: The DSP mailparse.dsp does not exist.

The search continues....

Related