Re: not _that_ fixed....
| From: | Robert Cummings | Date: | Tue, 26 Oct 2004 04:47:08 +0000 |
| Subject: | Re: not _that_ fixed.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200317@lists.php.net to get a copy of this message | ||
On Tue, 2004-10-26 at 00:37, Pierre Ancelot wrote:
>
> in fact i got it in the ./configure --help :
>
> pierre@debian:~/phpsource/php-4.3.9$ ./configure --help | grep -i spider
> --enable-spider Enable spider support
> pierre@debian:~/phpsource/php-4.3.9$
>
> which is okay. but if i run make, i got a few lines about it like :
>
> gcc -Iext/spider/ -I/home/pierre/phpsource/php-4.3.9/ext/spider/
> -DPHP_ATOM_INC -I/home/pierre/phpsource/php-4.3.9/include
> -I/home/pierre/phpsource/php-4.3.9/main -I/home/pierre/phpsource/php-4.3.9
> -I/home/pierre/phpsource/php-4.3.9/Zend
> -I/home/pierre/phpsource/php-4.3.9/ext/xml/expat
> -I/home/pierre/phpsource/php-4.3.9/TSRM -g -O2
> -c /home/pierre/phpsource/php-4.3.9/ext/spider/spider.c -o
> ext/spider/spider.o && echo > ext/spider/spider.lo
>
> and it goes without any error about my module.
> so, as the tutorial specifies it, i run the script created with my extension :
>
> pierre@debian:~/phpsource/php-4.3.9$ php -f ext/spider/spider.php
>
> Warning: dl(): Unable to load dynamic library
> '/usr/lib/php4/20020429/spider.so' - /usr/lib/php4/20020429/spider.so: cannot
> open shared object file: No such file or directory
> in /home/pierre/phpsource/php-4.3.9/ext/spider/spider.php on line 3
> Functions available in the test extension:<br>
>
> Warning: Invalid argument supplied for foreach()
> in /home/pierre/phpsource/php-4.3.9/ext/spider/spider.php on line 8
> <br>
> Module spider is not compiled into PHP
> pierre@debian:~/phpsource/php-4.3.9$
>
> after checking, i see this:
>
> pierre@debian:~/phpsource/php-4.3.9$ ls ext/spider/
> CREDITS EXPERIMENTAL config.m4 php_spider.h spider.c spider.lo spider.o
> spider.php tests
> pierre@debian:~/phpsource/php-4.3.9$
>
> The module is NOT created :'(
> Did i forget something in config.m4 ???
> something i didn't get in the tutorial ???
> http://www.php.net/manual/fr/zend.build.php
> no idea...
The 'make' command does not compile shared object extensions. You need
to do something different for that. However if PHP compiled properly
with the extension enabled then you shouldn't need to load your
extension via dl() since it should already be a part of the PHP binary.
That said, if you still wish to compile a shared object module of your
extension then you can run this from the PHP source directory (with
suitable changes for your extension):
cc -fpic -DCOMPILE_DL_INTERJINN=1 \
-Iext/interjinn/ -Iinclude -Imain -I. -IZend -ITSRM \
-c -o ext/interjinn/interjinn.o ext/interjinn/interjinn.c
cc -shared -L/usr/local/lib -rdynamic -o \
ext/interjinn/interjinn.so \
ext/interjinn/interjinn.o
I don't recall if it's necessary, but I compile PHP as a CGI binary
first and then run the above commands. If you want to allow support for
your extension as both a dl()'d module or as a built-in extension, then
you can check for the existence of one of your modules functions with
function_exists() and if it doesn't exist then use dl() to try and load
the shared module.
HTH,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'