Install php_mysql extension on windows/xampp PHP 7 - php

I have to work on legacy project which runs on php_mysql. My local environment is windows/xampp with PHP version 7.
I have downloaded php_mysql.dll from somewhere and added it to my php extension path c:/xampp/php/ext and added the line extension=php_mysql.dll to php.ini file. But still extension_loaded("mysql") returns false.
I ran php on command line and I get the following error:
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_mysql.dll' - The specified module could not be found.
I have:
restarted the apache everytime I made a change
tried adding the full path to php.ini
How can I install this extension?

Related

Installing mongodb for php & composer error

I am currently using xampp for PHP. I have downloaded php_mongodb-1.13.0-8.1-ts-vs16-x64 in my system and also installed xampp-windows-x64-8.2.0-0-VS16 in my system. In order to configure PHP for mongoDB, I have downloaded php_mongo.dll and pasted the .dll file in the '../php/ext' directory and also added extension=php_mongo.dll in the php.ini file.
Now when I try to install composer, it shows that Composer setup cannot continue with your current settings and throws the following errors.
The PHP exe file you specified did not run correctly:
E:\Project\XAMMP\php\php.exe
The php.ini used by your command-line PHP is: E:\Project\XAMMP\php\php.ini
A setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or a dll does not exist.
Program Output:
PHP Warning: PHP Startup: mongodb: Unable to initialize module
Module compiled with module API=20210902
PHP compiled with module API=20220829
These options need to match
Any help would be appreciated

Composer Installation "PHP Warning: PHP Startup: Unable to load dynamic library 'gd2'"

I am trying to install composer on my system but I am receiving an error "PHP Warning: PHP Startup: Unable to load dynamic library 'gd2'". I downloaded and placed the required gd_2.dll file in the folder. Checked php.ini for extension_dir and it has the absolute path E:\xampp\php\ext. Everything seems fine but I am still receiving this error. Please have a look at the screenshot below. In the image you can also see that I have the required .dll file highlighted which means I have the file that the installer reported as missing.
What should I do now?
I guess you have just installed PHP 8. Open your php.ini and locate the line near the bottom of the file:
[PHP_GD2]
extension=php_gd2.dll
Change the extension name from php_gd2.dll to php_gd.dll (this should match the one existing in your ext directory) and save the php.ini. Run the Composer installation again.
(PHP 8 somehow renamed php_gd2 to php_gd.)

what to do when i get following dll error while installing composer in xampp

I am getting the following error while installing composer 2.0 in the command-line PHP step. I am using xampp as a server.
The PHP exe file you specified did not run correctly:
C:\xampp\php\php.exe
The php.ini used by your command-line PHP is: C:\xampp\php\php.ini
A setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or a dll does not exist.
Program Output:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_smtp.dll' - The specified module could not be found.
in Unknown on line 0
PHP Warning: Module 'openssl' already loaded in Unknown on line 0
I have checked there is no php_smtp.dll in ext folder in xampp should i add one??
Although last time I checked, composer worked on xamp just fine without any additional need, but maybe your project's composer.json file or some dependency requires that, so you may follow the instructions below.
php_smtp extension is inbuilt in latest PHP (5.3 and above) for older versions:
Download php_smtp.dll file, and please scan the downloaded php_smtp.dll file with your preferred antivirus-tool and use it at your own risk.
Move the downloaded php_smtp.dll file to your "C:\xamp\php\ext" directory.
Open C:\xamp\php\php.ini file, and go to "Dynamic Extensions" commented section, there copy-paste this line somewhere, maybe below other extensions: extension=php_smtp.dll
Last but not least, restart XAMP.

Installing Composer OpenSSL Issue

I am trying to install composer however when I go to install it I get this error:
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl
I currently have php 5.4.31 and I am running WAMP2.2 I've checked my php.ini file in the bin/php/php5.4.31/ and ensured that the following line is uncommented:
extension=php_openssl.dll
The error still resolves and I'm at a loss as to how I can fix it. As I thought by uncommenting the line it would be enabled.
Also when I run this command in the terminal window php --ini I get the following message:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\php_openssl.dll' - The specified module could not be found
If you are a windows user, make sure to uncomment this line in your php.ini file:
extension_dir = "ext"
It makes sure that PHP is taking the extension from its own ext library.
#Javacadabra, extensions like php_openssl.dll will be under php/ext/ directory, you could fix this path in the config file or you could copy that specific file from php/ext directory to php directory.
in your case it will be c:\php\ext

PHP Startup: Unable to load dynamic library, Windows, Apache 2.2, php 5.2.11

This is becoming a very frustrating issue. I am trying to do a clean install of apache 2.2 and PHP 5.2.11. Everything seems to be configured correctly but the php modules aren't starting...
PHP Warning: PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_mcrypt.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '.;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0
in the php.ini
include_path = ".;C:\Program Files (x86)\Apache Software Foundation\Apache2.2\php"
extension_dir = ".;C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/"
All the files are there... The .dll files such as ssleay32.dll, libmcrypt.dll, libmysql.dll, libeay32.dll are all installed at...
C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/
I also included them in the C:\Windows\System32
and even added C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ to the windows path.
I have no idea why this isn't working and it feels like a no win situation. Anyone have any ideas on how to get this all working ok?
Try this:
extension_dir = "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/php/ext/"
without starting with the .;
You just uncomment the extension_dir in php.ini
Just for my future self if no-else. This is with PHP 5.2.13 running in Windows on IIS 8.
I got the following error:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_openssl.dll' - The specified module could not be found.
From phpinfo() the loaded php.ini file was C:\Program Files (x86)\PHP\php.ini.
The extension directory:
extension_dir ="C:\Program Files (x86)\PHP\ext"
These were the last two lines of the php.ini file:
[PHP_SQLSRV]
extension=php_sqlsrv_52_nts_vc6.dll
[PHP_OPENSSL]
extension=php_openssl.dll
The php_openssl.dll and php_sqlsrv_52_nts_vc6.dll files are in the ext directory. The php_openssl.dll isn't corrupt (it's the same file size as one on another machine that's working).
PHP will find the sqlsrv dll but not the openssl dll. No idea why. No amounts of IIS restarting did anything.
The solution until I know better was to install the openssl.dll extension using the Windows PHP installer. You can re-run the installer and select 'Change' and it allows you to add or remove libraries. I can't see any difference in the file or the php.ini file now, but now the file loads.
I suspect actually that my problem was similar to this comment about OpenSSL installation on Windows:
At this point, when you start Apache it will attempt to load php_openssl.dll, but if your setup is anything like mine you will see an error. I prefer to start Apache manually, and the error appears in a dialog box: "The ordinal 4114 could not be located in the dynamic link library LIBEAY32.dll". (I'm not sure whether you would get this message if you started Apache as a service). The Apache log also contains an error message saying that php_openssl.dll cannot be loaded, though that message doesn't name libeay32.dll. Welcome to DLL Hell.
Libeay32.dll enters the picture because php_openssl.dll depends on it (and also on ssleay32.dll). What I think happens is that Apache first tries to load php_openssl.dll programmatically from the path specified by the extension_dir key. But then, the loading of the so-called dependent DLLs is left to Windows' default mechanism. If Windows finds an incompatible version of a dependent DLL, you get the error.
I noticed errors about ssleay32.dll when trying to run php -i from the command line. I just assumed that it didn't have it in the environment. IIS made no mention of any ssleay32.dll errors in its logs.
Had same errors, but instead of copying files added php folder to system path and restated the server.
Windows 8.1 have a bib problem with system PATH names what cannot editable with the general editor because this line is too long......and for PHP module extension good loading must to define PHP path in the system enviroments.
ONLY one thing helped for me:
https://rix0rrr.github.io/WindowsPathEditor/

Categories