添加.so作为php扩展名 [英] Add .so as php extension
问题描述
我有一个用SWIG生成的.so文件.我想使用在那里定义为php扩展的功能.如何将它们添加为php扩展名?
I have a .so file generated with SWIG. I would like use the functions defined there as a php extension. How do I add them as a php extension?
我将.so添加到扩展目录,并在php.ini中添加一行:"extension = example.so",然后重新启动apache.
I added the .so to the extensions directory, and in php.ini added a line: "extension=example.so", then restarted apache.
在我运行时仍为: php -d"extension = example.so" -m
,它没有显示为扩展名,并说:无法加载动态库'/usr/lib/php5/...../example.so.无法打开共享对象文件:权限在第0行的未知"中被拒绝"
Still when I run: php -d "extension=example.so" -m
, it does not appear as an extension, and says:
"Unable to load dynamic library '/usr/lib/php5/...../example.so. cannot open shared object file: Permission denied in Unknown on line 0"
但是,权限为777
权限
PHP .so文件夹
PHP .so folder
php.ini文件
检查扩展名[
扩展名"example.so"不存在.
Extension "example.so" not there.
推荐答案
通过将.so的完整路径添加到php.ini中来解决
Solved by adding the full path of the .so to the php.ini
extension=/full/path/to/so/example.so
因此,不需要将.so添加到php extensions文件夹中..so可以位于任何目录中.
Therefore, adding the .so to the php extensions folder is unnecessary. The .so may reside in any directory.
这篇关于添加.so作为php扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!