Symfony serve looks for PHP libraries at the wrong place - php

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.

Related

How to fix PHP Warning: PHP Startup: Unable to load dynamic library 'xxx/xxx/yaf.so'?

[26-Nov-2021 21:49:17 Asia/Shanghai] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.6.40/lib/php/extensions/no-debug-non-zts-20131226/yaf.so' - dlopen(/Applications/MAMP/bin/php/php5.6.40/lib/php/extensions/no-debug-non-zts-20131226/yaf.so, 0x0009): tried: '/Applications/MAMP/bin/php/php5.6.40/lib/php/extensions/no-debug-non-zts-20131226/yaf.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/yaf.so' (no such file) in Unknown on line 0
You are loading the incorrect version for your PHP Version.
if this is Yet Another Framework
You can only use this on the version of PHP is created for.
for example if your PHP Version is 5.3
You would need a yaf.so to match PHP 5.3
Looking on there GIT this is a 5.2 build, so your PHP Version needs to match this.
Personally i would ditch the 5.3 you are running and install 7.0.
5.3 is very dated, pointless developing anything based on this.
When you have the right version, Place this inside your ext folder in PHP.
Edit your PHP.ini file
add in:
extension=yaf.so
Ensure your extension_dir is configured correctly too:
extension_dir = "ext"
your yaf should be in the same folder as the extension dir, just ensure extension is built for the PHP version you are using, they are not cross compatible

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

Unable to load dynamic library 'php_wincache.dll'?

Because I already use ASP.NET I decided to use PHP on IIS, I install it using Wep PI but when I trying to install Composer he fails with PHP settings error.
I tried to change the extension_dir to absolute and uncommented php_wincache extension in php.ini but none of my solutions works
C:\Program Files (x86)\iis express\PHP\v7.2\php.exe
The php.ini used by your command-line PHP is: C:\Program Files (x86)\iis express\PHP\v7.2\php.ini
A setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or the dll does not exist.
Program Output:
PHP Warning: PHP Startup: Unable to load dynamic library 'php_wincache.dll' (tried: C:\Program Files (x86)\iis express\PHP\v7.2\ext\php_wincache.dll (%1 n’est pas une application Win32 valide.), C:\Program Files (x86)\iis express\PHP\v7.2\ext\php_php_wincache.dll.dll (Le module spécifié est introuvable.)) in Unknown on line 0
It's a little late to answer this question. But I also face the same issue and somehow able to resolve it. Please follow below steps to resolve this.
Step 1: Install Windows Cache Extension for PHP.
You can install it from http://php.net/manual/en/wincache.installation.php
Or you can use Web Platform Installer. (Please see the screenshot.)
Step 2: After installation goes to folder "Windows Cache for PHP". Copy php_wincache.dll.
Step 3: Paste copied file into your PHP/ext location. e.g. "C:/Program Files/PHP/v7.0/ext".
Now you can try to install composer again.
I hope this will help you.
I've had the same problem and found the answer on PHP Manual.
The wincache version for 7.0 is compiled for php7.dll not the thread
safe php7ts.dll. You may need to compile the source for wincache or
change to the non thread safe version.
Guess is you have installed the "thread safe" version of PHP, and you don't have php7.dll which WinCache needs.

PHP ZMQ Extension: Unable to load dynamic library

I'm working on Wampserver on Windows 10.
I'm using an extension called ZMQ. I downloaded the DLLS from:
https://pecl.php.net/package/zmq/1.1.3/windows
I previously used the version of the extension for PHP 5.6 and it worked. The extension however had a bug, so I decided to upgrade my php version to 7.0.4 and try the new version of the extension.
The extension was successfully installed and it appears in the phpinfo(), but when I try to run "php -v" from the command line (or the CLI service that uses the extension), I get the following error: "Warning: PHP Startup: Unable to load dynamic library 'D:/wamp64/bin/php/php7.0.4/ext/php_zmq.dll' - The specified module could not be found.
in Unknown on line 0"
The weird thing is the file "php_zmq.dll" actually exists in the specified path.
Important note: I have the line "extension=php_zmq.dll" in both my "D:\wamp64\bin\apache\apache2.4.18\bin\php.ini" and my "D:\wamp64\bin\php\php7.0.4\php.ini" (which to my understanding is used by the CLI). I can't remove either of those lines because then the extension is removed, or it doesn't work in the CLI.
I had the same problem. using PHP 7.0 x64 TS. I used the exact dll from pecl but same error. all my other extensions load fine and are in the same directory
i followed all instructions on https://superuser.com/questions/585291/installing-zeromq-on-windows-7-wamp-server.
the main updates would be to do the following:
copy libzmq.dll and libsodium.dll to php root dir. (both are found in the pecl zip files.

Not Loading Firebird Extension

I'm trying to use the Firebird extension in PHP. I've got the extension files (php_pdo_firebird.dll, php_interbase.dll) in my ext folder. I'm adding them in my php.ini file like so
...
[PHP_PDO_FIREBIRD]
extension=php_pdo_firebird.dll
[PHP_INTERBASE]
extension=php_interbase.dll
...
No errors are being thrown saying the extensions could not be loaded and yet whenever I print my phpinfo I don't see either of them listed. What am I missing here?
For what it's worth, I'm running PHP version 5.3.14 TS using Apache 2.2 on Windows 7.
Edit: It seems some errors are being logged, it's just that my error_log setting was being overwritten (for those seeing this, double check C:\Windows\Temp\php-errors.log). Now it's telling me the specified modules could not be found whenever the file clearly exists.
PHP Warning: PHP Startup: Unable to load dynamic library
'C:\Program Files (x86)\PHP\ext\php_pdo_firebird.dll' -
The specified module could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'C:\Program Files (x86)\PHP\ext\php_interbase.dll' -
The specified module could not be found.
in Unknown on line 0
Figured it out! Okay, first to get the basics out of the way:
Make sure the version of the DLLs matches your PHP version.
For those who use the Windows installer, for some reason it doesn't provide an option to include the Interbase and Firebird modules so you'll have to download the matching .zip file and copy them from the ext folder in there.
Double check for any typos, such as unescaped backslashes, in your extension_dir setting. This only applies if the value isn't "wrapped in quotation marks."
Now for the coup de grace. That error message is extremely misleading. At this point it should be finding your DLLs but it's missing one integral piece: fbclient.dll which can be found in the bin folder of your Firebird installation. Everywhere I read before said to place fbclient.dll in the ext folder but it only works if you put it in the root of your PHP folder.
Hope this helps future wayward souls :)

Categories