Skip to content

Commit 37a5783

Browse files
committed
modify add mongodb ext(pkg-config libcurl4-openssl-dev libssl-dev)
1 parent ef67ca7 commit 37a5783

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

php-fpm/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ RUN apt-get update && \
88
libjpeg62-turbo-dev \
99
libpng-dev \
1010
libjpeg-dev \
11-
libmcrypt-dev
11+
pkg-config \
12+
libmcrypt-dev \
13+
libcurl4-openssl-dev \
14+
libssl-dev
1215

1316
RUN docker-php-ext-configure gd \
1417
--enable-gd-native-ttf \
@@ -19,6 +22,9 @@ RUN docker-php-ext-configure gd \
1922
docker-php-ext-install opcache && \
2023
docker-php-ext-enable opcache
2124

25+
RUN pecl install mongodb && \
26+
docker-php-ext-enable mongodb
27+
2228
RUN docker-php-ext-install pdo_mysql
2329
RUN docker-php-ext-install mcrypt
2430
RUN docker-php-ext-install zip

www/demo2/web/index.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
<?php
2-
echo "demo2";
2+
3+
#$manager = new MongoDB\Driver\Manager("mongodb://hyb:123456@47.111.0.166:27017/test");
4+
$manager = new MongoDB\Driver\Manager("mongodb://hyb:123456@192.168.0.102:27017/test");
5+
6+
$query = new MongoDB\Driver\Query([]);
7+
8+
$cursor = $manager->executeQuery('test.user', $query);
9+
10+
foreach ($cursor as $document) {
11+
print_r($document);
12+
}

0 commit comments

Comments
 (0)