Search code examples
phpxamppwampphp-extensionpecl

"pecl http" php extension can't be loaded in local (xampp/wampp)


I want to add the php "http" extension to xampp on Windows (https://pecl.php.net/package/pecl_http/4.2.2/windows). But every time I get the error in my console :

Warning: PHP Startup: Unable to load dynamic library 'http' (tried: C:\xampp\php\ext\http (Le module sp├®cifi├® est introuvable), C:\xampp\php\ext\php_http.dll (Le module sp├®cifi├® est introuvable)) in Unknown on line 0        PHP 8.1.27 (cli) (built: Dec 19 2023 23:28:30) (ZTS Visual C++ 2019 x64) Copyright (c) The PHP GroupZend Engine v4.1.27, Copyright (c) Zend Technologies

I follow the correct procedure for adding a php extension. I download the compatible .dll (in my case Thread Safe x64 for php 8.1), put it in the "xampp\php\ext" folder, then declare it in php.ini as follows: extension=httpand finally I restart the Apache server.

I checked by going to http://localhost/dashboard/phpinfo.php the necessary configuration and I'm in TS x64.

Catpure php info xampp

When I realized that I was using php 8.2 on xampp and that the latest pecl DLL was for 8.1 I tried to downgrade and download an 8.1 version by going to https://windows.php.net/download/.J I tested by downloading 8.1.27 (the only one visible on the 8.1 page) and then installing it on xampp but even that didn't work I still got the same error.

I miss surely something in the configuration ?
If you have any ideas I'd love to hear from you.
Thank you in advance.


Solution

  • Apparently the solution is to compile the .dll ourselves because the API version php of the extension compiled doesn't match with my current php version installed. Link of the article of John Hanley which explains it.

    I post another question here for it because I haven't managed to compile on Windows yet : Building an extension php .dll (ext_http)