3

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?

Dissident Rage
  • 2,610
  • 1
  • 27
  • 33
  • Have you enabled `php_openssl` in your `php.ini`? – Koala Yeung Oct 15 '19 at 02:59
  • There should be a line like `extension=php_openssl.dll` that you can uncomment and use. If not, simply add the line and restart the server to see if it works. – Koala Yeung Oct 15 '19 at 03:00
  • Please check [this answer](https://stackoverflow.com/a/14191542/372172) and [this answer](https://stackoverflow.com/a/16571090/372172). – Koala Yeung Oct 15 '19 at 03:02
  • Yes, it's enabled. I already said that. I made this question because that is the only answer anyone ever has and it does not work. – Dissident Rage Oct 15 '19 at 11:06

2 Answers2

4

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 .

ax.
  • 58,560
  • 8
  • 81
  • 72
  • 1
    It wasn't set, so I manually set it using `pecl config-set php_ini "C:\bin\php\%PHP_VERSION%\php.ini"` but the result is the same. – Dissident Rage Oct 18 '19 at 14:06
  • @DissidentRage, I am in exactly the same position as you. Hittin the exact same wall. I am just about to give up. – rockstardev Jan 23 '20 at 09:01
3

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....

rockstardev
  • 13,479
  • 39
  • 164
  • 296