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

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:
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.

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.

Related

Enabling MSgPack library in PHP 8.1

First time post on Stackoverflow so be forgiving.
I'm trying to get Msgpack (https://windows.php.net/downloads/pecl/releases/msgpack/2.1.2/) to work on my Windows 10 laptop. I have PHP 8.1.9 , VC 19 TS
I've downloaded the correct TS version and placed the DLL file in C:\PHP8\EXT folder
I've modified the php.ini file to include extension=php_msgpack.dll
No matter which TS version of Msgpack I always get the following error
PHP Warning: PHP Startup: Unable to load dynamic library 'php_msgpack.dll' (tried: ext\php_msgpack.dll (The specified module could not be found), ext\php_php_msgpack.dll.dll (The specified module could not be found)) in Unknown on line 0
I'd like to get some pointers to where I can start resolving this issue.
I've checked other posts on SO but could not find any fitting solution.

How to install YAML extension to PHP 7.4?

I'm trying to install YAML extension to PHP 7.4.4 on Windows.
Steps I've taken:
Downloaded the latest DLL package from https://pecl.php.net/package/yaml (currently 2.1.1) for 7.4 Non Thread Safe (NTS) x64.
Copied php_yaml.dll to the extension folder C:/my_path/bin/php/php-7.4.4-Win32-vc15-x64/ext
Added extension=yaml to php.ini.
At this point, all tutorials I've found instruct to copy yaml.dll to a bin folder, but there is no such file in the current YAML package.
When I run PHP now, it gives me the following error:
Warning: PHP Startup: Unable to load dynamic library 'yaml' (tried: C:/my_path/bin/php/php-7.4.4-Win32-vc15-x64/ext\yaml (The specified module could not be found.), C:/my_path/bin/php/php-7.4.4-Win32-vc15-x64/ext\php_yaml.dll (The specified module could not be found.)) in Unknown on line 0
What else do I need to do to get YAML to work in PHP?

Symfony serve looks for PHP libraries at the wrong place

I had previously multiple installations of PHP on my computer. I deleted all of them and reinstalled php from the official source which is now found at C:\\php.
The symfony serve command (ran from PhpStorm console) looks for missing modules in the wrong directory. (I don't even have xampp anymore, but even if I copy the files to the location it tries, it doesn't work) Xampp folder is not in my Path env variable either.
Warning: PHP Startup: Unable to load dynamic library 'php_ftp.dll' (tried: C:\xampp\php\ext\php_ftp.dll (The specified procedure could not be found.), C:\xampp\php\ext\php_php_ftp.dll.
dll (The specified module could not be found.)) in Unknown on line 0
Any ideas on this?
run symfony local:php:refresh to fetch available PHP version of your systems.
local:php:list for list locally available PHP versions
First problem turns out to be that PhpStorm does not see my PHP installations on C: for some kind of weird permission error. (PATH was correct).
The compiled Windows version of PHP downloaded from php.net defaults the extension folder to C:/php, which had to be overriden using php.ini's extension_dir="D:/php/ext" directive.

Can't Get Curl Enabled in PHP 7.3.9

I keep getting this error when I try to run cUrl:
Call to undefined function curl_init()
So I try to install it with these lines:
extension_dir = "C:\PHP7\ext"
extension=curl
But it never shows up in my phpinfo();
Here is from the Apache error log:
PHP Startup: Unable to load dynamic library 'curl' (tried: C:\\PHP7\\ext\\curl (The specified module could not be found.), C:\\PHP7\\ext\\php_curl.dll (The specified procedure could not be found.)) in Unknown on line 0
And I've also tried the absolute path to curl (extension=C:\PHP7\ext\php_curl.dll)
If:
Your settings look correct.
You're trying to load the right DLL for your PHP installation and not e.g. some random one you found in Google).
Curl works just fine from command-line PHP.
But you get this when running PHP as Apache module:
PHP Startup: Unable to load dynamic library 'curl' (tried: C:\...\ext\curl (The specified module could not be found.), C:\...\ext\php_curl.dll (The specified procedure could not be found.)) in Unknown on line 0
Then there's a chance that it gets fixed if you upgrade Apache to the latest build. (I've had that same problem myself.)
That was my problem too. I decided to upgrade my apache to Apache version 2.4.41
Link to binary if you install manually: https://www.apachelounge.com/download/
My php version is 7.3.9
good luck

MongoDB driver extension (php_mongodb.dll)) not found by PHP v7.2.5

I'm trying to add MongoDB extension to the PHP and use it with Laravel 5.6.
I know that I should download the dll file from PECL and copy it in the ext folder inside PHP and add extension=php_mongodb.dll to my php.ini file. But I face this warning when I do like what I said:
Warning: PHP Startup: Unable to load dynamic library 'php_mongodb.dll'
(tried: C:\php\ext\php_mongodb.dll (The specified module could not be
found.), C:\php\ext\php_php_mongodb.dll.dll (The specified module
could not be found.)) in Unknown on line 0
I'm a windows 10 user and my PHP version is 7.2.5.
Is it effect on MongoDB usage or It's ignorable and I can overtake it?
Update:
I also tested extension=php_mongodb.dll like extension=php_mongodb, extension=mongodb.dll, extension=php_mongodb.dll and extension=mongodb too.
And I copied the php_mongodb.dll to the C:\php\ext\php_mongodb.dll.

Categories