简体   繁体   English

mongodb php驱动程序是否需要php5-dev?

[英]Does the mongodb php driver require php5-dev?

I'm trying to install mongodb in a PHP environment. 我正在尝试在PHP环境中安装mongodb。 MongoDB itself is installed fine, I've run pecl install mongo , and added extension=mongo.so to php.ini; MongoDB本身安装得很好,我已经运行了pecl install mongo ,并向php.ini中添加了extension=mongo.so but my Laravel application complains that it can't find the class MongoClient. 但我的Laravel应用程序抱怨找不到类MongoClient。 Checking phpinfo() reveals no mention of Mongo, suggesting that it isn't aware of the driver. 检查phpinfo()并没有提及Mongo,表明它不知道驱动程序。

I noticed that all the instructions for installing mongo on Ubuntu mention apt-get install php5-dev . 我注意到,在Ubuntu上安装mongo的所有说明都提到apt-get install php5-dev Is that a requirement for the mongodb php driver? 这是mongodb php驱动程序的要求吗? At the moment the server is built with Chef and installs php with apache2::mod_php5 . 目前,服务器是使用Chef构建的,并使用apache2::mod_php5安装php。 If php5-dev is required, can it be installed as an apache module? 如果需要php5-dev ,可以将其安装为apache模块吗?

Yeah you should as stated by docs here http://docs.mongodb.org/ecosystem/drivers/php/ Also if its unable to find mongo drivers ,Try debugging , check logs if it says something like mongo.so file is missing. 是的,您应该按照此处的文档所述http://docs.mongodb.org/ecosystem/drivers/php/如果它无法找到mongo驱动程序,请尝试调试,检查日志是否显示诸如mongo.so文件丢失。

Don't forget to restart php and apache after saving php.ini 保存php.ini后不要忘记重新启动php和apache

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM