[英]PHP, mongo.so failed to write
Any help would be great. 任何帮助都会很棒。 I've been stuck on this for hours.
我已经坚持了几个小时。 I'm trying to install Mongo to work with PHP on a Mac.
我正在尝试安装Mongo以在Mac上使用PHP。 I have Pear/pecl installed and working.
我安装了Pear / pecl并正在工作。 When I call
sudo pecl install mongo
, everything looks like it's compiling/building successfully, but at the end I get this message. 当我调用
sudo pecl install mongo
,一切看起来都在成功编译/构建,但最后我收到了这条消息。
Build process completed successfully Installing '/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so' ERROR: failed to write /usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so (copy(/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so): failed to open stream: Operation not permitted)
构建过程成功完成安装'/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so'ERROR:写入/ usr / lib / php / extensions / no-debug-non-zts失败-20121212 / mongo.so(copy(/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so):无法打开流:不允许操作)
And the mongo.so never gets written. mongo.so永远不会写。 Can someone help?
有人可以帮忙吗? I'm using MAMP on Mac OSX El Capitan.
我在Mac OSX El Capitan上使用MAMP。
I've solved this problem by changing extension_dir
in php.ini
. 我通过更改
php.ini
extension_dir
解决了这个问题。
Create a local extension dir and copy your existing extensions into 创建本地扩展目录并将现有扩展名复制到
mkdir -p /usr/local/lib/php/extensions
cp /usr/lib/php/extensions/no-debug-non-zts-20121212/* /usr/local/lib/php/extensions/
Update your php.ini
, change the extension_dir
and enable mongo: 更新你的
php.ini
,更改extension_dir
并启用mongo:
extension_dir = "/usr/local/lib/php/extensions/"
extension=mongo.so
Now the extension dir is writeable you can copy the mongo.so
there. 现在扩展目录是可写的,你可以复制
mongo.so
。
Here's how to compile a mongo.so 这是编译mongo.so的方法
wget http://pecl.php.net/get/mongo
tar xzvf mongo
cd mongo-1.6.12
phpize
./configure --with-php-config=/usr/bin/php-config --with-mongo-sasl=no
make
You can find the compiled library in .libs folder: .libs/mongo.so
Copy it to extensions dir 您可以在
.libs/mongo.so
文件夹中找到已编译的库: .libs/mongo.so
将其复制到扩展名目录
cp .libs/mongo.so /usr/local/bin/php/extensions/
Finally, you can check whether it's working or not, by typing php -m | grep mongo
最后,您可以通过输入
php -m | grep mongo
来检查它是否正常工作 php -m | grep mongo
in the command line. php -m | grep mongo
在命令行中。
Robert has solved this problem in this answer. 罗伯特在这个答案中解决了这个问题。 stackoverflow.com/a/31884146 .
stackoverflow.com/a/31884146 。
Basically the issue is the El Capitan's Rootless feature. 基本上问题是El Capitan的Rootless功能。 Its needs to be disabled in recovery mode, perform the pecl install and that enable it back again .
需要在恢复模式下禁用它,执行pecl安装并再次启用它。
For some reason , pecl did not install it into my php extensions directly so, I had to copy the mongo extension pecl generated from the local library to my php extension folder xampp files for it to work 由于某种原因,pecl没有直接将它安装到我的php扩展中,因此,我不得不将从本地库生成的mongo扩展pecl复制到我的php扩展文件夹xampp文件中以使其工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.