Home > Backend Development > PHP Tutorial > How to Install MySQLi on macOS?

How to Install MySQLi on macOS?

Linda Hamilton
Release: 2024-11-19 08:53:02
Original
859 people have browsed it

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
Copy after login

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';
}
?>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template