Re: openssl extension not loading (need to open https stream)



Václav Stoupa wrote:

On Mar 12, 6:30 am, Chuck Anderson <websiteaddr...@xxxxxxxxx> wrote:
I run Apache 2.0.55, and Php (both 4.4.1 and 5.2.5) on my home PC
(Windows XP). One of the scripts that I run daily needs to access a
secure URL (https://..............). When I am running Php4, it can
open the file.

However, when I run Php5 I (now) get this error message:
"Unable to find the wrapper "https" - did you forget to enable it when
you configured PHP?"

This is new. Last time I messed with this, I merely got:
"failed to open stream: Invalid argument"

I can see in phpinfo that the only registered streams are:
php, file, data, http, ftp, compress.zlib

I need https and ftps to be in that list, too.

Today I made the php.ini files for Php4 and Php5 nearly identical (the
only difference being the locations of some directories (extensions and
tmp). I downloaded the latest Windows binary from Php.net (5.2.5) and
installed (unzipped) it on my computer and am testing with that. I have
libeay32.dll and ssleay32.dll installed in the Windows System32 folder
(Where they need to be - in the executable Path. That's why Php4
works). I have also enabled the openssl extension and made sure it is
in the extension folder ("php5.2.5/ext").

When I run a script with
echo '<pre>';
print_r(stream_get_wrappers());
echo '</pre>';

echo '<pre>';
print_r(get_loaded_extensions());
echo '</pre>';

I get:

Array
(
[0] => php
[1] => file
[2] => data
[3] => http
[4] => ftp
[5] => compress.zlib
)

Array
(
[0] => bcmath
[1] => calendar
[2] => com_dotnet
[3] => ctype
[4] => session
[5] => filter
[6] => ftp
[7] => hash
[8] => iconv
[9] => json
[10] => odbc
[11] => pcre
[12] => Reflection
[13] => date
[14] => libxml
[15] => standard
[16] => tokenizer
[17] => zlib
[18] => SimpleXML
[19] => dom
[20] => SPL
[21] => wddx
[22] => xml
[23] => xmlreader
[24] => xmlwriter
[25] => apache2handler
[26] => curl
[27] => mbstring
[28] => exif
[29] => gd
[30] => mhash
[31] => printer

No openssl. (??) I was getting an error logged about the
php_printer.dll not being found, but after I put it in the extension
folder, it then showed up in the above list. And now the error log is
empty.

Another new thing I noticed today is that If I run Php.exe (from the
root folder of php5.2.5) and execute the above file, I get this
(abbreviated):
....
[25] => curl
[26] => mbstring
[27] => exif
[28] => gd
[29] => mhash
[30] => openssl
[31] => printer

So run from the command line, I can see that openssl is loaded ... and,
in fact, I can execute my script that access the secure URL (https:)
successfully.

Executing "php -i" even shows me:
Registered PHP Streams => php, file, data, http, ftp, compress.zlib,
https, ftps

So now I seem to be getting somewhere. What I don't understand is why
the apache module (which is how I always run Php - php5apache2.dll)
does not load the openssl extension. It doesn't even give me an error
message about it. It simply is not loaded. Why does the command line
load the extension, but not the Apache module? (The command line and
module use the same php.ini file. That's how they both loaded the
printer extension).

I would really like to move on and put Php4 behind me, but this
roadblock has been in my way for over a year now.

Any ideas what's wrong, or what I need to try? (I believe the problem
is simply that the openssl extension does not load successfully ... but
without errors?)

Thanks in Advance for any help.

Hello,
same proble today! Solved!

Look to your error.txt file in log directory if your Apache.

Probably there would be something like:

Unable to load php_openssl.dll...

So extension for ssl is not loaded.

You got it, ... thanks. I am mighty pleased at the coincidence.

Although, I must point out that the error was not in Apache's error log, rather in Php's error log - in the Php folder (error logging must be enabled in php.ini). Every time I restarted Apache, I would get this error in the php error log file (twice, just like this):

[12-Mar-2008 20:08:29] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Php5.2.5\ext\php_openssl.dll' - The operating system cannot run %1.
in Unknown on line 0
[12-Mar-2008 20:08:31] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Php5.2.5\ext\php_openssl.dll' - The operating system cannot run %1.
in Unknown on line 0

According this http://php.net/manual/en/ref.openssl.php#79441 I found
libeay32.dll and ssleay32.dll in my Apache2/bin folder.

When I replaced them with those files bundled with php it starts to
work!

Yes! When I copied libeay32.dll and ssleay32.dll from the Php folder to apache/bin, overwriting the ones already there (I have Apache with OpenSSL, and that must be why the other older ones were there), it finally started working!!

Good grief. I've been at this for a year and a half .... or more. I had placed those files in the php folder and in windows/system32 .... but hadn't tried that yet. I can finally retire Php4 from my home PC.

Enjoy!

Thank you! Thank you! Thank you!!! I wish I could buy you (... and me) a liter of Budvar!

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
***********************************

.



Relevant Pages

  • Re: Fwd: [PHP] php not reading file properly
    ... On Fri, Aug 22, 2008 at 10:22 AM, Ashley Sheridan ... I think the whole logs folder is restricted from php ... the file at the very same instant that Apache is writing to it logging ...
    (php.general)
  • Re: Cannot find page- cgiemail
    ... This depends on your host server supporting PHP files ... How to modify the code: ... The "mailer.php" and the "thank_you.htm" MUST be in the same folder as the form page. ... > where do i find out what extension my mailer has? ...
    (microsoft.public.publisher.webdesign)
  • Re: security concerns for PHP on win2k
    ... are higher than the one the script resides in. ... Anyone know if they fixed the php ... > I have Apache with PHP running on a win2k box. ... > his public_html folder he can use windows security to grant the apache ...
    (alt.php)
  • Re: Fwd: [PHP] php not reading file properly
    ... I think the whole logs folder is restricted from php ... On Fri, Aug 22, 2008 at 10:13 AM, Ashley Sheridan ... the file at the very same instant that Apache is writing to it logging ...
    (php.general)
  • Re: redirect / new website how to redirect old (google) links to new site ?
    ... his first suggestion was to tell Apache to parse all .html ... files with PHP, whether they included PHP code or not. ... can omit the extension when Apache is configured appropriately. ...
    (comp.lang.php)