简体   繁体   English

dreamhost上的Mongo PHP驱动程序?

[英]Mongo PHP driver on dreamhost?

I'm trying to get the mongo php extension to work on dreamhost. 我正在尝试将mongo php扩展程序用于dreamhost。

I have followed 2 tutorials and still nothing is showing up mongowise. 我已经关注了2个教程,但仍然没有显示mongowise。

I have php 5.3 installed, and using a phprc file I added extension = /home/(myusername)/bin/mongo.so 我安装了php 5.3,并使用phprc文件添加了extension = /home/(myusername)/bin/mongo.so

I've compiled the mongo.so file from github using these instructions: 我使用以下指令从github编译了mongo.so文件:

http://wiki.dreamhost.com/PHP.ini#Compiling_PHP_5.3_extensions http://wiki.dreamhost.com/PHP.ini#Compiling_PHP_5.3_extensions

Then copied the mongo.so to the /bin/mongo.so directory. 然后将mongo.so复制到/bin/mongo.so目录。

I'm using phpinfo() to check installed extensions. 我正在使用phpinfo()来检查已安装的扩展。 It does show that the phprc is being loaded. 它确实显示正在加载phprc

Is there a way of testing the mongo.so file to make sure it works with php? 有没有办法测试mongo.so文件,以确保它适用于PHP? ie some command line php -test mongo.so or something. 即一些命令行php -test mongo.so或其他东西。 Any other tips? 还有其他提示吗?

I did get this working. 我确实得到了这个工作。 I started from scratch, and wget downloaded the extension from pecl, instead of github. 我从头开始,wget从pecl下载扩展,而不是github。 I extracted and then followed the instructions found in the links above. 我提取然后按照上面链接中的说明进行操作。

First, make sure you use php 5.3 to compile and run mongo. 首先,确保使用php 5.3编译并运行mongo。 Dreamhost is using PHP 5.2 as default, so the domain you want to be running MongoDB needs to be set to PHP 5.3 (probably FastCGI is best choice). Dreamhost默认使用PHP 5.2,因此要运行MongoDB的域需要设置为PHP 5.3(可能是FastCGI的最佳选择)。

To test and use it on command line you can run: 要在命令行上测试和使用它,您可以运行:

php-5.3 -r "phpinfo();"

It will show all installed PHP modules and you should see your mongo there. 它将显示所有已安装的PHP模块,您应该在那里看到你的mongo。

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

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