php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78086 Curl silently fails to load under mod_php
Submitted: 2019-05-30 08:01 UTC Modified: 2019-06-25 07:56 UTC
From: alvaro at demogracia dot com Assigned:
Status: Closed Package: Apache2 related
PHP Version: 7.3.6 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alvaro at demogracia dot com
New email:
PHP Version: OS:

 

 [2019-05-30 08:01 UTC] alvaro at demogracia dot com
Description:
------------
Not sure if there's a problem with the Windows builds but I'm using php-7.3.5-Win32-VC15-x64 under Windows 10 and the Curl extension doesn't load at all when running PHP via Apache.

It works fine in command-line but not when running as module for Apache/2.4.29 (Win64) with the same php.ini file, which is essentially identical to the one I was using successfully in php-7.3.0-Win32-VC15-x64. I'm not getting error messages of any kind but the extension doesn't show up in phpinfo() and it isn't avaible.

Test script:
---------------
var_dump(PHP_VERSION, defined('CURLOPT_HEADER'), function_exists('curl_setopt'));

Expected result:
----------------
In command-line it prints:

string(5) "7.3.5"
bool(true)
bool(true)

Actual result:
--------------
In Apache it prints:

string(5) "7.3.5"
bool(false)
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-30 08:08 UTC] alvaro at demogracia dot com
My excuses, I hadn't found the correct log file. I'm getting:

PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: ext\\curl (No se puede encontrar el m\xef\xbf\xbddulo especificado.), ext\\php_curl.dll (No se encontr\xef\xbf\xbd el proceso especificado.)) in Unknown on line 0
 [2019-05-30 08:27 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2019-05-30 08:27 UTC] cmb@php.net
Likely the dependent DLLs (such as libssh2.dll) can't be found.
Did you add the PHP folder to your PATH[1]?

[1] <https://www.php.net/manual/en/curl.installation.php>
 [2019-05-30 08:51 UTC] alvaro at demogracia dot com
-Status: Feedback +Status: Assigned
 [2019-05-30 08:51 UTC] alvaro at demogracia dot com
Yes, I have. I'm actually using a symlink (mklink command) so the path never changes, I hope that's not an issue.

According to Process Monitor, "httpd.exe" is trying to load "libssh2.dll" from all sort of locations except PHP directory:

- Apache's base and "bin" directory
- C:\Windows\System32\libssh2.dll
- C:\Windows\System\libssh2.dll
- C:\Windows\libssh2.dll
- Graphics Magick directory
- Oracle Instant Client directory
- C:\Srv\PHP\PEAR\libssh2.dll

... so it's obviously not taking PHP folder into consideration. It's weird because this same set-up works fine for 7.0, 7.1 and 7.2. I'll check everything again *sigh*
 [2019-05-30 16:39 UTC] cmb@php.net
Also check that there's no "wrong" DLL loaded.
 [2019-05-30 17:38 UTC] requinix@php.net
Apache (actually Windows) won't try to load libssh2 from the PHP directory because that's not where it knows to look: it checks the location of the executable, system directories, and the system or user PATH depending how the application is being run. And I don't know if a symlink will work, assuming it's in one of those locations of course.

Put libssh2 in the Apache directory, in System32, or add PHP to the system PATH and restart.
 [2019-05-31 18:16 UTC] cmb@php.net
-Status: Assigned +Status: Feedback
 [2019-05-31 18:16 UTC] cmb@php.net
Any news here?
 [2019-06-09 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2019-06-19 08:47 UTC] alvaro at demogracia dot com
-Status: No Feedback +Status: Closed -PHP Version: 7.3.5 +PHP Version: 7.3.6
 [2019-06-19 08:47 UTC] alvaro at demogracia dot com
Sorry for the delay (a trip got in between). I've verified to the best of my ability that:

- PHP directory belongs to PATH
- Apache recognises such PATH
- Apache finds and loads successfully the copy of libssh2.dll provided by PHP binaries (according to Process Monitor)

... yet Curl is still unavailable under Apache (though it loads fine in command-line):

PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: ext\\curl (No se puede encontrar el m\xef\xbf\xbddulo especificado.), ext\\php_curl.dll (No se encontr\xef\xbf\xbd el proceso especificado.)) in Unknown on line 0

I've also tried almost every 7.3.x release for Win64 and learnt that:

- 7.3.0 and 7.3.2 work fine.
- 7.3.3 to 7.3.6 fail.

I mentioned I'm using symlinks—I've switched to regular directories just to be safe. I've restarted several times. Nothing changed.

I'm totally clueless so far. Is there anything else you'd like me to try?
 [2019-06-19 09:02 UTC] cmb@php.net
-Status: Closed +Status: Re-Opened
 [2019-06-19 09:02 UTC] cmb@php.net
Thanks for the feedback!

Have you tried to use an absolute path for extension_dir?
 [2019-06-19 11:01 UTC] alvaro at demogracia dot com
With an absolute path:

PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: C:\\Opt\\PHP\\ext\\curl (No se puede encontrar el m\xef\xbf\xbddulo especificado.), C:\\Opt\\PHP\\ext\\php_curl.dll (No se encontr\xef\xbf\xbd el proceso especificado.)) in Unknown on line 0
 [2019-06-19 11:54 UTC] cmb@php.net
You can run the following script from Apache:

  <?php
  exec('"C:\\Opt\\PHP\\deplister" "C:\\Opt\\PHP\\ext\\php_curl.dll"', $output);
  print_r($output);

All DLLs should be OK.
 [2019-06-19 12:50 UTC] alvaro at demogracia dot com
Array
(
    [0] => php7ts.dll,OK
    [1] => libcrypto-1_1-x64.dll,OK
    [2] => libssl-1_1-x64.dll,OK
    [3] => WLDAP32.dll,OK
    [4] => Normaliz.dll,OK
    [5] => libssh2.dll,OK
    [6] => nghttp2.dll,OK
    [7] => KERNEL32.dll,OK
    [8] => WS2_32.dll,OK
    [9] => VCRUNTIME140.dll,OK
    [10] => api-ms-win-crt-stdio-l1-1-0.dll,OK
    [11] => api-ms-win-crt-string-l1-1-0.dll,OK
    [12] => api-ms-win-crt-heap-l1-1-0.dll,OK
    [13] => api-ms-win-crt-convert-l1-1-0.dll,OK
    [14] => api-ms-win-crt-runtime-l1-1-0.dll,OK
    [15] => api-ms-win-crt-time-l1-1-0.dll,OK
    [16] => api-ms-win-crt-utility-l1-1-0.dll,OK
    [17] => api-ms-win-crt-filesystem-l1-1-0.dll,OK
    [18] => api-ms-win-crt-environment-l1-1-0.dll,OK
)
 [2019-06-21 08:50 UTC] cmb@php.net
-Assigned To: cmb +Assigned To:
 [2019-06-21 08:50 UTC] cmb@php.net
Since I cannot reproduce this, and there don't seem to be (many)
others having the same issue, I still guess there's a setup
problem somewhere, but I have no ideas how to debug that further.
 [2019-06-21 09:14 UTC] alvaro at demogracia dot com
Fair enough. I've just got a similar computer to test and it runs flawlessly here. I bet it's an antivirus issue or something like that. I'll dig deeper in to it.
 [2019-06-25 07:56 UTC] alvaro at demogracia dot com
-Status: Re-Opened +Status: Closed
 [2019-06-25 07:56 UTC] alvaro at demogracia dot com
I've upgraded Apache from httpd-2.4.29-Win64-VC15 to httpd-2.4.39-win64-VS16 (Apache Lounge builds) and that immediately solved my issues.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jul 17 00:01:27 2019 UTC