作者:寒时凝结公寓_264 | 来源:互联网 | 2024-12-27 19:58
Thisguideprovidesacomprehensivestep-by-stepapproachtosuccessfullyinstallingtheMongoDBPHPdriveronXAMPPformacOS,ensuringasmoothandefficientsetupprocess.
This guide offers a detailed method for installing the MongoDB PHP driver on XAMPP for macOS. Follow these steps to ensure a successful setup:
- Ensure you have the following installed on your Mac:
- MongoDB
- XAMPP for macOS
- Homebrew Package Manager
Open your terminal and execute the following commands:
brew install wget
brew install autoconf
sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongodb
Add the line extension=mongodb.so
to your php.ini file, typically located at /Applications/XAMPP/xamppfiles/etc/php.ini
.
Restart Apache by running:
sudo /Applications/XAMPP/xamppfiles/xampp restartapache
To verify the installation, you can check if the MongoDB extension is loaded by creating a PHP file with
and accessing it via your web browser.
Tip: If MongoDB is not already installed, you can use Homebrew to install it:
brew install mongodb