I cannot find instructions about installing MySQLi on a Mac. Just to be clear, MySQL is up to date and I am running PHP 5. How do I install it? Where do I even get it from? Thanks for your help. I'll be giving an up vote and a check mark to whoever answers this!
The MySQL native driver for PHP is a drop-in replacement for the MySQL Client Library for the PHP script language. PHP MySQL extensions. The PHP MySQL extensions are lightweight wrappers on top of a C client library. There are 3 PHP MySQL extensions: ext/mysql (not recommended) ext/mysqli; PDOMySQL; Extension Feature Comparison ».
hakre14 Answers
MySQLi is part of PHP. There should be a php-mysqli type package available, or you can take the PHP source and recompile that mysqli enabled. You may already have it installed, but it's done as a module and is disabled. Check your php.ini for extension=mysqli.so
or similar. it may be commented out, or the .so file is present in your extensions directory but not linked to PHP via that extension= directive.
This article is clearly explained, how to install MySqli with EachApache. This works for me too.
To install mysqli using EachApache:
Login to WHM as 'root' user.
Either search for 'EasyApache' or go to Software > EasyApache
Scroll down and select a build option (Previously Saved Config)
Click Start 'Start customizing based on profile'
Select the version of Apache and click 'Next Step'.
Select the version of PHP and click 'Next Step'.
Chose additional options within the 'Short Options List'
Select 'Exhaustive Options List' and look for 'MySQL Improved extension'
Click 'Save and Build'
This is how I installed it on my Debian based machine (ubuntu):
php 7:
php 5:
Ajeet ShahAjeet ShahYou are supposed to edit two lines in your php.ini file (i'm using windows for this example):
-The first one is regarding the extensions directory location. See below:
-The second one is regarding the extension itself:
Only modifying (uncommenting) the extension line was not enough for me. Hope it helps
Here is the link for installation details: http://php.net/manual/en/mysqli.installation.php
If you are using Windows or Linux:
- The MySQLi extension is automatically installed in most cases, when PHP & MySQL package is installed.
Since you are using a Mac, open a terminal, and
- cd /etc
Find the php.ini, and sudo open it, for example, using the nano editor
- nano php.ini
Find use control+w to search for 'mysqli.default_socket', and change the line to
- mysqli.default_socket = /tmp/mysql.sock
Use control+x and then hit 'y' and 'return' to save the file. Restart Aapche if necessary.
Now you should be able to run mysqli.
I recently ditched Xampp in favor of the native Apache on Mac Sierra because a new php requirement of a project. Sierra comes with php 5.6.25, but it doesn't run mysql_* out of the box, after a lot of googling, I found this site really help - https://php-osx.liip.ch. As it turns out php 5.6.25 does support mysql_* but wasn't enabled. Choose your version of php and download it, it generates a proper php.ini for your php, then you are good to go
For windows: 3 steps
step1:Just need to give the ext
folder path in php.ini
here
step 2:Remove the comment from
step 3:restart the Apache server.
Free File Extension Repair
Happy coding!!!
if you use ubuntu 16.04 (maybe and above) just do this
Yu JiaaoYu JiaaoSince many of these answers are old here is how to install mysqli for Easyapache 4.
If you try and search for mysqli under your php extensions in WHM you are not going to find it. The way to know which extension you need to install mysqli you will need to run this command in terminal
Should return something like
All you really need from this is mysqlnd copy it
To install mysqli using EachApache4:
- Login to WHM.
- Search for 'EasyApache4'
- At the top look for 'Currently Installed Packages' and click on the button 'Customize'
- On the left panel click 'PHP Extensions'
- Search for mysqlnd
- You should see something like 'php70-php-mysqlnd'
- Toggle the switch to enable it
- On the left panel click on review
- At the bottom click 'Provision'
- Your Done
Have a nice day!
Cesar BielichCesar BielichI had the same issue, I went to EasyApache4 from the WHM clicked on customize button then PHP Extension tab.. I selected and installed the extension php72-php-mysqlnd
and my was solved
Repair File Associations Windows 7
Ogbonna VitalisWindows 7 File Extension Fix
Arch users (if using mariadb) just should find the following line in /etc/php/php.ini
and uncomment it.