I built a PHP extension using SWIG. It's a shared lib which i put into my php project on my small linux box. The project lives within the directory /var/www/my_web and also the extension shared lib is positioned in /var/www/my_web/assets/library/.

Within the file /etc/php5/cli/php.ini, I added the road:

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

Within the file /etc/php5/apache2/php.ini, I added the road:

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

I've got a test php page that does the next...

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

Basically run that test page with the cli PHP, things are fine. I recieve html which i may even save and open inside a browser. Looks good. However, basically really browse towards the page, I recieve:

[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)

within the apache log.

Other areas of my_web work all right, but this test page doesn't. Another factor I observed is when I only do print_r(get_loaded_extensions()) with no other line, it really works in apache and that i do see my_lib listed like a loaded extension. So, it appears only if I attempt to gain access to my_lib in apache do problems occur.

I'm using php 5.3.2, apache 2.2.14, and swig 2..1.

Please, any suggestions or surveys are greatly appreciated.

Thanks.

Have you link your extension with libraries also associated with Apache, but different versions/pathways? Try searching at what apache has packed with e.g. lsof or pmap and rival ldd of the extension.