Video 1 Connect PHP and MongoDB, Download MongoDB Driver Connect PHP MongoDB to Localhost

Опубликовано: 16 Сентябрь 2023
на канале: Sports And Study
3,385
30

https://pecl.php.net/package/mongodb
To use MongoDB with PHP, you need to use MongoDB PHP driver. Download the driver from the url Download PHP Driver. Make sure to download the latest release of it. Now unzip the archive and put php_mongo.dll in your PHP extension directory ("ext" by default) and add the following line to your php.ini file −

extension = php_mongo.dll

Make a Connection and Select a Database
To make a connection, you need to specify the database name, if the database doesn't exist then MongoDB creates it automatically.

Following is the code snippet to connect to the database −


// connect to mongodb
$m = new MongoClient();

echo "Connection to database successfully";
// select a database
$db = $m-mydb;
echo "Database mydb selected


На этой странице сайта вы можете посмотреть видео онлайн Video 1 Connect PHP and MongoDB, Download MongoDB Driver Connect PHP MongoDB to Localhost длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Sports And Study 16 Сентябрь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 3,385 раз и оно понравилось 30 зрителям. Приятного просмотра!