0

Today I have migrated my XAMPP's internals to 64bit:

  • Apache (from 32bit 2.4.25 to 64bit 2.4.27)
  • PHP (from 32bit 7.1.4 to 64bit 7.1.9)

I have downloaded each extension used before in 32bit, installed, configured (copy&paste mostly with path changes if needed) and generally everything "works".

-> % php --version
PHP 7.1.9 (cli) (built: Aug 30 2017 18:34:46) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

PHPINFO

But somehow I get PHP Startup: Unable to load dynamic library errors even if there are valid DLLs (most of them bundled in downloaded PHP package). These are curl, intl, ldap and imagick (the last one is installed by me). Paths are correct in php.ini (many other extensions are loaded properly from the same directory). This is what I get in php_error_log every time when I access page through Apache:

[22-Sep-2017 15:52:47 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_curl.dll' - The specified module could not be found.
 in Unknown on line 0
[22-Sep-2017 15:52:47 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_intl.dll' - The specified module could not be found.
 in Unknown on line 0
[22-Sep-2017 15:52:47 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_ldap.dll' - The specified module could not be found.
 in Unknown on line 0
[22-Sep-2017 15:52:47 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'D:\Bin\XAMPP\7.0.9\php\ext\php_imagick.dll' - The specified module could not be found.
 in Unknown on line 0

In CLI everything is fine (it's the same php.ini as for Apache):

-> % php -i | grep -n3 curl
175:curl
178-cURL Information => 7.55.0

-> % php -i | grep -n3 ldap
347:ldap
349-LDAP Support => enabled
350-RCS Version => $Id: 0779387e5f88edc656159d12b9302a053e82cc79 $

-> % php -i | grep -n3 intl
330:intl
332-Internationalization support => enabled
333-version => 1.1.0
335-ICU Data version => 57.1

but in Apache I have Attempted to call function "curl_init" ... error :(

Any ideas?

Wirone
  • 3,304
  • 1
  • 29
  • 48
  • first make sure that apache's php.ini has log_errors on, then post the error logs. most likely, though, the dll's are compiled for a different version of php. the error logs will tell you if this is the case, and help us help you. also i think this question should be in Serverfault – hanshenrik Sep 22 '17 at 18:24
  • 3 extensions are bundled with PHP (downloaded from official site) so they are valid (and work in CLI). Only `imagick` is custom, but I've selected matching version (VC14, x64, PHP7.1, TS). I have logs enabled but there are only errors like I posted above: `PHP Startup: Unable to load dynamic library`, nothing more. Both PHP and Apache logs (on debug level) does not contain anything that could tell me what is going on. I am confused. – Wirone Sep 22 '17 at 23:20

5 Answers5

1

I had the same problem on Windows 10 and solved it by adding the php home directory to the system (NOT user!) PATH environment and rebooting the system. When Apache is installed as a service it is run as a system user which means it does not see your user environment variables.

yaugenka
  • 2,602
  • 2
  • 22
  • 41
0

it's basically 404'ing the dll's. either the user that apache runs as, doesn't have permissions to read the folder D:\Bin\XAMPP\7.0.9\php\ext\ , or the folder doesn't exist. as for why it works in cli but not in apache, they're probably reading different php.ini's , but it could also be that php-cli runs as a different user account. to check that, run php -r 'phpinfo();' | grep -i username in cli, and a page with <?php phpinfo(); and look for "Enviorment" > "User" in apache phpinfo(); , the pages will also tell you if they're loading the same php.ini file.

and nothing of this has anything to do with programming, so i say again, this should be on serverfault.com or something, not stackoverflow.com

hanshenrik
  • 19,904
  • 4
  • 43
  • 89
  • There is explicit information that `php.ini` is the same and path is correct (when I copy path from error log and paste it to explorer it tries to open file). Those extensions are read properly in CLI, through Apache many other extensions work from the same ext directory and exact config convention (`extension=php_something.so`). I don't know how to debug it more, why those extensions are invalid (found, but not loaded) in Apache. – Wirone Sep 24 '17 at 15:48
0

Check if your DLL's are in proper version. There is quite often difference between x64 and x86 version, also between ZTS and NON TREAD SAFE. For some reason instead of nice error message of ddls being incompatible you will only get information: cannot load extension.

Seti
  • 2,169
  • 16
  • 26
0

Well, this is weird but the root problem of this issue was... using Apache as service. I can't explain why, but when running Apache as service these extensions could not be loaded, but when running without service, using only "Start" from XAMPP control center, all is working fine with the same config and directory/file structure.

I realized that when I wanted to back to my previous working versions and I linked 32bit versions again (I use apache and php symlinks in XAMPP installation dir). cURL was not loaded, but it was working before migrating to 64bit. So I started digging and experiment with service and after unregistering it started working correctly. So I thought it could be the case with 64bit too... And it was.

Now I can start Apache properly. There is still minor issue because XAMPP control panel doesn't show Apache as running after clicking "Start", but processes are there and is working. But most important is everything is OK under the hood.

Wirone
  • 3,304
  • 1
  • 29
  • 48
0

I had the same problem. All extensions loaded except these two: amqp and pdo_sqlite:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: D:\\xampp74\\php\\ext\\pdo_sqlite (The specified module could not be found.), D:\\xampp74\\php\\ext\\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 'amqp' (tried: D:\\xampp74\\php\\ext\\amqp (The specified module could not be found.), D:\\xampp74\\php\\ext\\php_amqp.dll (The specified module could not be found.)) in Unknown on line 0

One solution is so add the php path to your environmental variable PATH.

The real problem here is that although extension dlls live in xampp\php\ext, some extensions have additional files that are located in xampp\php. These additional dlls are the ones that can not be loaded if the php path is not added to your PATH.

If you do not want to add the PHP path to your PATH, the solution is to add the extra dll files to the xampp\apache\bin folder (copy, not move). In my case:

  • libsqlite3.dll for pdo_sqlite
  • rabbitmq.4.dll and rabbitmq.4.pdb for php_amqp

Or, if you start apache via a batch file, add the php path before starting apache:

SET PATH=%PATH%;d:\xampp74\php
pluk77
  • 126
  • 3