WordPress – OpenCart – SEO – Web Development

Cài đặt PHP driver cho MongoDB.

Cài đặt PHP driver cho MongoDB. kiểm tra phiên bản https://docs.mongodb.com/ecosystem/drivers/php/ MongoDB server làm việc với web server chứ không phải PHP. Vì vậy, chúng ta cần PHP-MongoDB driver để PHP có thể nói chuyện được với MongoDB server. Đó là một thư việc của PHP. Cài đặt đơn giản sử dụng pecl thông qua lệnh sau:
_sudo pecl install mongo_
Tiếp theo, config cho php nhận module mongodb.
_sudo -i__
__echo 'extension=mongo.so' >> /etc/php5/apache2/php.ini_
Cuối cùng, khởi oộng lại apache. Để kiểm tra xem cài đặt đã thành công chưa, bạn tạo file phpinfo.php <?php phpinfo();?    bên trong thư mục gốc của apache và mở file này lên. Nếu bạn nhìn thấy mongo thì việc cài đặt đã thành công. Link: https://viblo.asia/p/basic-crud-application-using-mongodb-and-php-KAyQMpgPR0Ek khi có lỗi check lại
Try Justin's solution first with pecl (you'll want to use yum rather than aptitude to install php-devel), but if that doesn't work, I happen to have the manual build procedures on hand already for my own deploy reference. :) Installing the PHP MongoDB driver As root:
  1. export PHP_AUTOCONF=/usr/bin/autoconf
  2. export PHP_AUTOHEADER=/usr/bin/autoheader
  3. wget http://pecl.php.net/get/mongo-1.0.9.tgz
  4. tar -xzf mongo-1.0.9.tgz
  5. cd mongo-1.0.9
  6. phpize
  7. ./configure
  8. make && make install
  9. To /etc/php.d/mongo.ini, add: extension=mongo.so
link kham khảo: https://stackoverflow.com/questions/4292362/how-to-install-php-mongo-on-centos-5-3
You can upgrade to a specific version of a driver by using pecl:
sudo pecl install -f mongo-1.4.5
If you get a pecl: command not found error you will need to install PEAR package:
sudo apt-get update && sudo apt-get install php-pear
You can use this command to check that you have the correct version installed:
sudo pecl info mongo
Or you can check php configuration directly with:
php -i | grep -A 1 MongoDB
Lưu ý: Cài PHP MongoDB driver phải check đúng phiên bản không thì không chạy dc Gỡ cài dat

sudo pecl uninstall mongo

 
 

Từ khóa:

Giới thiệu tác giả

Giới thiệu tác giả: .

Gửi bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Top