PHP extension is not recognised on Windows (using PHP 7.4)

Issue

I need the Event library for my project in PHP. The main project is running on a raspberry pi but I’m writing and testing the code completely on my Windows PC. To run the PHP code, I use the XAMPP.

I tried to import the Event extension within my code but in the command window, I keep getting the same error:

D:\xamd server\php>php.exe -i
PHP Warning:  PHP Startup: Unable to load dynamic library 'event' (tried: D:\xamd server\php\ext\event (The specified module could not be found.), D:\xamd server\php\ext\php_event.dll (The specified module could not be found.)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'event' (tried: D:\xamd server\php\ext\event (The specified module could not be found.), D:\xamd server\php\ext\php_event.dll (The specified module could not be found.)) in Unknown on line 0
phpinfo()
PHP Version => 7.4.12

This error is weird in my opinion since the file which it can’t fine on this link, should be there:

"Proof" that the file is indeed in the correct folder

I also added this file in some different folders such as system32 and apache\bin but none of this helps.
I downloaded the extension: "7.4 Thread Safe (TS) x64" from: https://pecl.php.net/package/event/3.0.7RC1/windows which should be the correct one for my PHP version.

And I also edited the php.ini file to add this extension to the library.

I’m probably forgetting one step but I have no idea what.
Would be great if someone could help me with this one.

Solution

The same error is displayed if the extension DLL was compiled for a different version of PHP.

Using Windows Explorer, right-click on the DLL and select properties, then Details. Check the Product version value.

The actual issue is that PHP extensions have an API version such as 20200930. The API version must match PHP and the extension. The CLI command php -i | grep API will display this information.

Answered By – John Hanley

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published