BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / www-technology / #10150同步于 2010/6/11
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖

菜鸟求助,PHP里怎么调用c的动态库?

thtyhust
2010/6/11镜像同步9 回复
在linux下照下面这篇文章试了怎么都不成功,为啥啊?没配置好? http://edu.codepub.com/2010/0521/22866.php
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
BookMoth机器人#1 · 2010/6/11
老大……我觉得你至少告诉我们你进行到哪一步不行了吧……
thtyhust机器人#2 · 2010/6/11
嗯,就进行到在 /var/www/下建立一个 hello.php 文件,然后再浏览器里输入127.0.0.1/hello.php,没反应啊,就这样写的 <?php dl("hello.so"); echo hello_add(3, 4); ?> 不调用dl(),显示各字符串还是可以的 【 在 BookMoth 的大作中提到: 】 : 老大……我觉得你至少告诉我们你进行到哪一步不行了吧…… : --
BookMoth机器人#3 · 2010/6/11
没报错么?打开php.ini里面的display_errors选项看看。 【 在 thtyhust 的大作中提到: 】 : 嗯,就进行到在 /var/www/下建立一个 hello.php 文件,然后再浏览器里输入127.0.0.1/hello.php,没反应啊,就这样写的 : <?php : dl("hello.so"); : ...................
ericyosho机器人#4 · 2010/6/11
Notes Note: dl() is not supported in multithreaded Web servers. Use the extensions statement in your php.ini when operating under such an environment. However, the CGI and CLI build are not affected ! Note: As of PHP 5, the dl() function is deprecated in every SAPI except CLI. Use Extension Loading Directives method instead. Note: Since PHP 6 this function is disabled in all SAPIs, except CLI, CGI and embed. Note: dl() is case sensitive on Unix platforms. Note: This function is disabled when PHP is running in safe mode.
coolfantasy机器人#5 · 2010/6/11
你的 .so 是怎么编译出来的 【 在 thtyhust (大猴子) 的大作中提到: 】 : 嗯,就进行到在 /var/www/下建立一个 hello.php 文件,然后再浏览器里输入127.0.0.1/hello.php,没反应啊,就这样写的 : <?php : dl("hello.so"); : ...................
thtyhust机器人#6 · 2010/6/12
我把所有的错误选项打开,然后刷新网页提示以下错误: Fatal error: Call to undefined function dl() in /var/www/hello.php on line 2 这是怎么回事呢?没定义dl()? dl()还要自己定义么?该怎么定义呢? 【 在 BookMoth 的大作中提到: 】 : 没报错么?打开php.ini里面的display_errors选项看看。
xw2423机器人#7 · 2010/6/12
If the functionality of loading modules is not available (see Note) or has been disabled (either by turning it off enable_dl or by enabling 安全模式 in php.ini) an E_ERROR is emitted and execution is stopped enable_dl打开了么 【 在 thtyhust (大猴子) 的大作中提到: 】 : 我把所有的错误选项打开,然后刷新网页提示以下错误: : Fatal error: Call to undefined function dl() in /var/www/hello.php on line 2 : 这是怎么回事呢?没定义dl()? : ...................
thtyhust机器人#8 · 2010/6/12
打开了呢 【 在 xw2423 的大作中提到: 】 : If the functionality of loading modules is not available (see Note) or has been disabled (either by turning it off enable_dl or by enabling 安全模式 in php.ini) an E_ERROR is emitted and execution is stopped : enable_dl打开了么
thtyhust机器人#9 · 2010/6/12
$ gcc -O -c -fPIC -o hello.o hello.c $ gcc -shared -o libhello.so hello.o 就这样的 【 在 coolfantasy 的大作中提到: 】 : 你的 .so 是怎么编译出来的