Home > Article > Backend Development > How to Install MySQLi on macOS?
Installing MySQLi on macOS
Installing MySQLi on a Mac can be a straightforward process if you follow the right steps. MySQLi is a PHP extension that allows you to connect to MySQL databases. Despite its name, it doesn't provide direct access to MySQLi, but instead serves as a compatibility layer between PHP and MySQL's native C API.
To install MySQLi on macOS, you'll need to use php-mysqlnd instead of php-mysql. Here's how you can do it using apt-get:
apt-get install php-mysqlnd
Once installed, you can check if MySQLi is available by running the following command in a PHP script:
<?php if (extension_loaded('mysqli')) { echo 'MySQLi extension is installed'; } else { echo 'MySQLi extension is not installed'; } ?>
If the output is 'MySQLi extension is installed,' you're good to go.
The above is the detailed content of How to Install MySQLi on macOS?. For more information, please follow other related articles on the PHP Chinese website!