PHP Warning: running PHP: invalid library (maybe not PHP library)

In the past, I created a shared library, which now I would like to use it inside the php extension. Can this be done? As I saw in the config.m4 file PHP_NEW_EXTENSION() , .cc is requested. The problem is that I do not want to expose my code. I just want to use the header and shared library that I created in c under ubuntu. For the php extension, I created: config.m4, php_c.h and php_c.cc.

Please, help!. thanks APPRECIATE I put in the configuration file:

 libs=mylib.so; PHP_ADD_LIBRARY_WITH_PATH(libs, $EXTERNAL_LIB_DIR, ?? what to add here); 

I get the following:

 PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) '/home/foder/mylib.so'in Unknown on line 0 

php: character search error:

 /usr/php5/20090626+lfs/vehicles.so: undefined symbol: _ZN3CarC1Ei (where vehicles.so) is a php so created with: phpize, ./configure --enable-vehicle make.. 
+8
c ++ php ubuntu php-extension
source share
1 answer
 PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) '/home/foder/mylib.so'in Unknown on line 0 

This message means that there is no get_module function in .so.
Make sure the source of the PHP extension contains the lines:

 #ifdef HAVE_CONFIG_H #include "config.h" #endif 

and

 #ifdef COMPILE_DL_MYLIB ZEND_GET_MODULE(mylib) #endif 
+16
source share

All Articles