Guus Van Wezel
Guus Van Wezel

Reputation: 45

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

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.

Upvotes: 2

Views: 938

Answers (1)

John Hanley
John Hanley

Reputation: 81454

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.

Upvotes: 1

Related Questions