>  기사  >  백엔드 개발  >  错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory,errorwhileloading_PHP教程

错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory,errorwhileloading_PHP教程

WBOY
WBOY원래의
2016-07-12 08:52:174652검색

错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory,errorwhileloading

执行以下代码,生成唯一的UID

<span>$fp</span> = <span>popen</span>("/xxx/bin/tools/uuidgen system", "r"<span>);//
</span><span>$uid</span> = <span>fread</span>(<span>$fp</span>, 40960<span>);
</span><span>pclose</span>(<span>$uid</span>);

问题:返回结果$uid为空。实际上执行popen函数后能够返回内容 resource(39) of type (stream)

 

resource popen ( string $command , string $mode ) 参数:$command 命令,$mod 模式。

打开一个指向进程的管道,该进程由派生给定的 command 命令执行而产生。

如果未找到要执行的命令,会返回一个合法的资源,它允许访问shell返回的任何错误信息。

/* 加入重定向以得到标准错误输出 stderr。 */

<span>$fp</span> = <span>popen</span>("/xxx/bin/tools/uuidgen system 2>&1", "r");

这样,会看到输出错误  error while loading shared libraries: libcurl.so.4: cannot open  shared object file: No such file or directory

表示系统不知道libcurl.so放在哪个目录下。

 

解决办法:

/etc/ld.so.conf中加入libcurl.so所在的目录。

一般so档案会在/usr/local/lib这个目录下(用户可以自定义目录),所以在/etc/ld.so.conf中加入/usr/local/lib(或用户自定义的目录)这一行,

最后,保存/etc/ld.so.conf,执行命令[root@www]# /sbin/ldconfig -v才能生效。

 

参考:http://blog.csdn.net/kangear/article/details/9141481

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1127596.htmlTechArticle错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory,errorwhileloading 执行以下代码,生成唯一的...
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.