请教高手:我在freebsd下面编写php扩展,出现错误Unable to load dynamic library

hahu 2006-02-15 10:16:54
下面是我操作的过程
1. ext目录下面./ext_skel --extension=test_module
2. 编辑test_module目录下的config.m4,去掉下面三行的dnl注释
dnl PHP_ARG_ENABLE(test_module, whether to enable test_module support,
dnl Make sure that the comment is aligned:
dnl [ --enable-test_module Enable test_module support])
3. 执行./buildconf
4. 执行./configure --enable-test_module
5. 编译make
6. 测试扩展./php -f ext/sms_queue/test_module.php
出现下面这样的错误
Content-type: text/html
X-Powered-By: PHP/4.3.1

<br />
<b>Warning</b>: dl() [<a href='http://www.php.net/function.dl'>function.dl</a>]: Unable to load dynamic library

'./test_module.so' - Cannot open "./test_module.so" in <b>/home/packages/php-4.3.1/ext/test_module/test_module.php</b> on line

<b>3</b><br />
Functions available in the test extension:<br>
<br />
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/home/packages/php-4.3.1/ext/test_module/test_module.php</b> on

line <b>8</b><br />
<br>
Module test_module is not compiled into PHP
...全文
234 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
gu1dai 2006-02-17
  • 打赏
  • 举报
回复
unix下php的扩展都是必须编译时加进去的吧。
和windows下改个php.ini就可以了不同。
sdsuper 2006-02-17
  • 打赏
  • 举报
回复
你先在web上看看info.php,看看php使用的ini文件是哪一个,以及ext的目录确认一下
非windows平台上的东西就是比较麻烦,生成的文件没有固定放在特定的位置,一般在makefile里面有写生成文件的输出位置
Mistruster 2006-02-17
  • 打赏
  • 举报
回复
rm -Rf ./configure
./buildconf --force

---

编译不一定要有.so文件
你的test_module也许还要需要其它库的支持
./configure --with-test_module=/xxx/yyy
wshcdr 2006-02-16
  • 打赏
  • 举报
回复
来等上帝.
hahu 2006-02-16
  • 打赏
  • 举报
回复

在freebsd下面的php.ini,我找到了
但是里面的extension一个都没有指定,但可以用,不知道是不是和windows下面不一样
我make,刚开始的调试的时候能显示错误,最后没有错误了,能看到所在目录下面有.o和.lo文件生成,但是没看到有.so文件
sdsuper 2006-02-16
  • 打赏
  • 举报
回复
如果确认编译没有问题的话
请把.so文件复制到ini文件指定的ext目录中,并在ini文件中添加该扩展
如果不能确认。请把makefile文件贴上来看看
ps:好久没有在类Linux下编译php模块了。都在windows下写

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧