missing mysql extension in MAMP - php

I'm just shifting from wamp to mamp on windows.
Through mamp every thing is working perfectly (WordPress or PHP Projects).
1) In cmd when I work with wp-cli.phar file, it's give me the following error
your php installation appears to be missing the mysql extension which is required by wordpress
I check the php.ini files, extension path is perfect, php_mysql.dll isn't here. then I change PHP version 5.6.13 here I have php_mysql.dll extension but problem is same.
2) Also set the environment variable C:\MAMP\bin\php\php7.0.0;
When I check PHP Variable Path with phpinfo(); path are
Why it show wamp and mamp both path ?
Both problem have relation with each other ?

The path variable holds the windows OS' path environment variable's contents. Apparently, you have multiple versions of php installed: v5.5 and v7.0 and MAMP uses v7.0.
If you check out mysql's documentation on mysql extension, you will see that:
This extension is deprecated as of PHP 5.5.0, and has been removed as of PHP 7.0.0. Instead, either the mysqli or PDO_MySQL extension should be used. See also the MySQL API Overview for further help while choosing a MySQL API.
So, if you want to keep using mysql extension, then you need to downgrade the php version you use.
The other option is to upgrade to at least wordpress v3.9 because it can use mysqli extension instead of mysql.

Related

How to enable mysqli with PHP 7?

I have the latest version of Apache (Apache 2.4), latest version of PHP (PHP7), and latest version of MySQL (not sure the version but I have WorkBench version 6.3). In the past, when I checked if my PHP was working by this line of code <?php phpinfo(); ?> it would show that I have MySQL / mysqli installed and ready to go. But with PHP7 it shows mysqlnd.
I try using mysqli commands to check if I can connect to my database by mysqli_ping() and I also tried connecting to the database using server, user, pass. I keep getting errors such as Class mysqli not found. Or Call to undefined function mysqli_ping(). I've tried searching the net for some answers and All I could find was that I need to install MySQL (but a few sites said it was deprecated).
Am I able to get mysqli for PHP7? Or do I use mysqlnd? What is mysqlnd? Is it a new version of MySQL/mysqli?
Update 2020
For Windows 10 users I strongly recommend windows subsystem for linux (WSL 2) and setup your server there.
If you need php and mysql access in windows environment, then the fastest way is to install Wampserver. If you also need access to php through console then add php location (like C:\wamp64\bin\php\php7.4.11) to environment variables.
If that doesn't suit you and you need full setup always enabled on your system then follow install with choco.
To work properly with apache and load all needed extensions (including php_mysqli) you need ThreadSafe version of PHP, so make sure to download correct version or if you use Chocolatey to manage your windows applications, then just install php with this command:
choco install php --package-parameters='"/ThreadSafe "'.
This will install php in C:\tools\php72 directory, but you can overwrite it with another parameter:
choco install php --package-parameters='"/ThreadSafe ""/InstallDir:C:\PHP"""'.
The mysqlnd extension is part of PHP. It was developed as an alternative to bundling the libmysqlclient, because that library had license conditions that made it awkward to bundle with PHP.
You won't use mysqlnd directly. It's an internal library that is used by mysqli and pdo_mysql as a means to communicate with the MySQL Server.
As for mysqli, yes, it's available for PHP 7. I don't use Windows, but apparently not all extensions are enabled by default.
You probably need to edit your php.ini and uncomment the line
extension=ext_mysqli.dll
or whatever it is for that extension. It might already be in the file, but commented out. So go take a look and see.
Check if your system path environmental variable includes the PHP installation directory. That worked for me on with PHP 7.1 / Apache 2.4 / Windows Server 2016.

can't enable PDO in localhost apache php vesion 5.2.6

I can't enable PDO in my localhost.
I have read the php installation manual and attempted to do the same thing, but it isn't working.
When i open phpinfo and search for pdo it appear that pdo_mysql is not enabled, as shown in the below image.
I uncommented all pdo extension in php.ini and that didn't help.
I also searched for the pdo.dll in my extension and found it.
Any ideas what is wrong?
From the image of your phpinfo it's only showing sqllite and mysql is missing.
In PHP 5.2 I believe PDO is not available under default compile so you'll need to make sure it's actually compiled into PHP by adding --with-pdo-mysql into your compile script or if available via your webhosting panel somewhere. Personally I'd recommend having your PHP version updated to a secure version but as always you have to make sure any existing code is compatible.

How to enable php_mssql.dll extension in xampp 1.8.x

I'm using xampp-win32-1.8.3-1-VC11-installer and i enabled php_mssql.dll extension in php.ini by remove ;
I copy php_mssql.dll to xampp\php\ext
and ntwdblib.dll to xampp\apache\bin
i got 2 files above in old of xampp version.
But when i start my apache in xampp then i get
How to fix that thanks
It announced from php website http://php.net/manual/en/intro.mssql.php
These functions allow you to access MS SQL Server database.
This extension is not available anymore on Windows with PHP 5.3 or later.
SQLSRV, an alternative extension for MS SQL connectivity is available from Microsoft: ยป http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx.
Since XAMPP 1.8.0 its used PHP 5.4.4 and php_mssql.dll extension is not available anymore on windows with PHP 5.3 or later.
So you can't use this library to your new XAMPP although you get it from your old XAMPP.
You must use alternative extension to connect to MS SQL Server database like SQLSRV.
See also ::
http://php.net/manual/en/intro.mssql.php
http://stackoverflow.com/questions/7402713/how-to-get-mssql-work-with-php-5-3
Your php version from XAMPP 1.8.3 is PHP 5.5.15, so you must use "php_sqlsrv_55_nts.dll" or "php_sqlsrv_55_ts.dll". Those files can be downloaded from http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=20098`.
Note :: see also the information on Details section to help you choose file that you must download
This link about documentation to code with sqlsrv library
http://php.net/manual/en/book.sqlsrv.php
Windows PHP extensions are neither forward nor backward compatible between second-level PHP versions. That means you cannot use a PHP 5.3 extension in PHP 5.4 and vice-versa.
As you're running XAMPP 1.8.3 and this is one of the first PHP bundles with the VC11-PHP5.5 builds you'll have to find a VC11-PHP5.5 compatible extension somewhere else.
I've just checked another WAMP bundle called EasyPHP, but they don't ship the MS SQL extension with their VC11-PHP5.5 bundle either.
I can't help with finding a compatible extension, though.
You could also build the extension yourself if that is an option for you.

Why mysql driver is not currently installed Error is coming on Local Server?

I have a php project developed using zend framework, when i hosted to my local server(CentOS) i got the
below error:
The mysql driver is not currently installed
I have installed and enabled pdo_mysql on php.ini, but it is not effected my phpinfo.
Phpinfo only show pdo_sqlite not see pdo_mysql.
Another issue in my machine is phpinfo shows PHP version 5.2.8 and from terminal it shows PHP 5.1.6. Are there two php version running my machine?
Help is highly appreciated.
Check your phpinfo() output for the location of the php.ini file used and make sure to adapt that file. It's perfectly possible to have multiple versions of php running on a single computer.
It will show near the top of the output as (here's mine):
Loaded Configuration File /etc/php5/apache2filter/php.ini
that would be the location of the file you need to edit to affect your webserver instance php behaviour.
make sure to extension=php_pdo_mysql.so in it to load the mysql pdo driver
finally also make sure that extension_dir points to the directory where your libraries are found, using an absolute path; you can find that in phpinfo() under Core (and in your php.ini when you want to adapt it obviously)

Is there a place I can find all the extensions of PHP?

Now I'm seeking of php_pdo_mysql.dll version 5.2.5.5,
only found this:
http://dllcentral.com/php_pdo_mysql.dll/5.2.5.5/
But my zend studio 5.5 says it's invalid!
Is there any other place I can try my luck?
Brrr, I really wouldn't download binaries (that could do anything they please on the system, and possibly even the web pages that get served) from locations like that.
Isn't PDO included in PHP by default since 5.0?
From the PDO installation manual:
PDO and all the major drivers ship with PHP as shared extensions, and simply need to be activated by editing the php.ini file:
THe pdo extentions come default with php installation as far as I know.
You should try to uncoment the package in your php.ini file and then reload apache.
Looking at this I would have thought that you wouldn't need a DLL at all. From here:
PDO ships with PHP 5.1, and is
available as a PECL extension for PHP
5.0; PDO requires the new OO features in the core of PHP 5, and so will not
run with earlier versions of PHP.
Official binaries can be found at:
http://windows.php.net/download/
However, you say you already have a Windows binary. Look at it carefully: you should already have that DLL available. Probably, you need to rerun the installer and select that extension.

Categories