开发者

php extension works with CLI, segmentation fault with apache

I built a PHP extension using SWIG. It is a shared lib that I placed in my php project on my linux box. The project lives in the directory /var/www/my_web and the extension shared lib is placed in /var/www/my_web/resources/library/.

In the file /etc/php5/cli/php.ini, I added the line:

extension=/var/www/my_web/resources/library/my_lib.so

In开发者_开发问答 the file /etc/php5/apache2/php.ini, I added the line:

extension=/var/www/my_web/resources/library/my_lib.so

I have a test php page that does the following...

print_r(get_loaded_extensions());
print_r(get_extension_funcs("my_lib"));

If I run that test page through the cli PHP, everything is fine. I get html that I could even save and open in a browser. Looks good. However, if I actually browse to the page, I get:

[Fri Jan 07 11:37:18 2011] [notice] child pid 3918 exit signal Segmentation fault (11)
[Fri Jan 07 11:37:18 2011] [notice] child pid 3919 exit signal Segmentation fault (11)

in the apache log.

Other parts of my_web work just fine, but this test page does not. The other thing I noticed is that if I only do print_r(get_loaded_extensions()); without the other line, it works in apache and I do see my_lib listed as a loaded extension. So, it seems only when I try to access my_lib in apache do problems occur.

I am using php 5.3.2, apache 2.2.14, and swig 2.0.1.

Please, any suggestions or comments are greatly appreciated.

Thanks.


Did you link your extension with libraries also linked to Apache, but different versions/paths? Try looking at what apache has loaded with e.g. lsof or pmap and compare to ldd of your extension.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜