How to install MySQLi on MacOS


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!

5/21/2020 4:19:59 AM

Accepted Answer

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

8/30/2011 10:14:23 PM

This article is clearly explained, how to install MySqli with EachApache. This works for me too.

To install mysqli using EachApache:

  1. Login to WHM as 'root' user.

  2. Either search for "EasyApache" or go to Software > EasyApache

  3. Scroll down and select a build option (Previously Saved Config)

  4. Click Start "Start customizing based on profile"

  5. Select the version of Apache and click "Next Step".

  6. Select the version of PHP and click "Next Step".

  7. Chose additional options within the "Short Options List"

  8. Select "Exhaustive Options List" and look for "MySQL Improved extension"

  9. Click "Save and Build"


This is how I installed it on my Debian based machine (ubuntu):

php 7:

sudo apt-get install php7.0-mysqli

php 5:

sudo apt-get install php5-mysqli

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

; Directory in which the loadable extensions (modules) reside.
; extension_dir = "./"
; On windows:
extension_dir = "C:/php/ext"

-The second one is regarding the extension itself:


Only modifying (uncommenting) the extension line was not enough for me. Hope it helps

For windows: 3 steps

step1: Just need to give the ext folder path in php.ini


; Directory in which the loadable extensions (modules) reside.
; extension_dir = "./"
; On windows:
 extension_dir = "C:\php7\ext"

step 2: Remove the comment from


step 3: restart the Apache server.

Happy coding!!!


Here is the link for installation details:

If you are using Windows or Linux:
- The MySQLi extension is automatically installed in most cases, when PHP & MySQL package is installed.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Email: [email protected]