I. How To Compile and install
II. Note about Apache
I. How To Compile and install
0. Uninstall PHP
1. Download gnokii 0.6.14 *sources* or later from gnokii.org; compile and install
2. Get PHP 4 *sources* from php.net
3. If you plan to debug this extension then configure PHP using
--enable-debug --enable-experimental-zts
If you plan to use PHP with Apache then add --with-apxs
./configure --with-apxs --enable-debug --enable-experimental-zts --prefix=/usr
make && sudo make install
Compiling this beta version has been tested only after installing
PHP 4 from source with debug options enabled.
Note that this might replace the existant php executable and break your
current install because extensions are searched in a subdirectory of the
source tree, that's why I suggest to uninstall PHP in the first step.
4. Untar the extension sources inside php-x.y.z/ext then configure and compile
cd gnokii
phpize
./configure --enable-gnokii
make && sudo make install
5. Test
php -r 'dl("gnokii.so"); gnokii_open(); print_r( gnokii_identify() );'
II. Note about Apache
You need to enable the extension in php.ini adding
extension=gnokii.so
in the section "Dynamic Extensions" because you cannot load it
using dl() inside the script in a threaded server.
Comments
Hi daniele ! I have a problem
Hi daniele !
I have a problem when using gnokii4php.
i compiled and install gnokii, when using CLI it execute
I did following your guide but when i test : php -r 'dl("gnokii.so"); gnokii_open(); print_r( gnokii_identify() );' there is an error :
php: symbol lookup error: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/gnokii.so: undefined symbol: gn_lib_phoneprofile_load_from_file.
I don't know why? i use CentOS 5.4, Gnokii 0.6.29 , apache 2, php 5.2.14 and your gnokii4php.
Hope your help !
Sorry about my EngLish.
The
The gn_lib_phoneprofile_load_from_file function was added in 0.6.28. Check if your gnokii4php got linked to an older version.
Print the library that gnokii4php is trying to load:
ldd /usr/local/lib/php/extensions/no-debug-non-zts-20060613/gnokii.so | grep libgnokii
do the same with your gnokii 0.6.29:
ldd /usr/bin/gnokii | grep libgnokii
the two lines must be identical, if they are different then you have two libraries, uninstall the older one if you don't need it or force the configure script to use the newer one.
Hello Daniele, I try to
Hello Daniele,
I try to compile php module for gnokii, but after I make configure and try to make "make", I get this error:
/bin/sh /usr/src/php-5.2.6/ext/gnokii/libtool --mode=compile gcc -I. -I/usr/src/php-5.2.6/ext/gnokii -DPHP_ATOM_INC -I/usr/src/php-5.2.6/ext/gnokii/include -I/usr/src/php-5.2.6/ext/gnokii/main -I/usr/src/php-5.2.6/ext/gnokii -I/tmp/php/include/php -I/tmp/php/include/php/main -I/tmp/php/include/php/TSRM -I/tmp/php/include/php/Zend -I/tmp/php/include/php/ext -I/tmp/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.2.6/ext/gnokii/gnokii.c -o gnokii.lo
mkdir .libs
gcc -I. -I/usr/src/php-5.2.6/ext/gnokii -DPHP_ATOM_INC -I/usr/src/php-5.2.6/ext/gnokii/include -I/usr/src/php-5.2.6/ext/gnokii/main -I/usr/src/php-5.2.6/ext/gnokii -I/tmp/php/include/php -I/tmp/php/include/php/main -I/tmp/php/include/php/TSRM -I/tmp/php/include/php/Zend -I/tmp/php/include/php/ext -I/tmp/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.2.6/ext/gnokii/gnokii.c -fPIC -DPIC -o .libs/gnokii.o
/usr/src/php-5.2.6/ext/gnokii/gnokii.c: In function 'php_gnokii_init_globals':
/usr/src/php-5.2.6/ext/gnokii/gnokii.c:203: error: request for member 'state' in something not a structure or union
make: *** [gnokii.lo] Error 1
Can You help me please and tell me what I make wrong?
Thanks a lot.
Mareg
Hi Mareg, Your line number
Hi Mareg,
Your line number 203 doesn't match, but I think this problem was fixed with this commit.
The current version from http://git.savannah.gnu.org/cgit/gnokii/gnokii-extras.git/ builds with PHP 5.26 for me, I tested again right now following directions in the README.
Since this extension is now in a gnokii's repository you can also use official support channels for gnokii, that way I will probably answer faster.