Re: Unable to load extension (was Re: PHP to C interface?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



N Deepak wrote:
> On Fri, Feb 18, 2005 at 09:20:02AM -0800, Richard Lynch wrote:
> 
>>N Deepak wrote:
>>
>>>  Is there a way to invoke C functions in a library (.so) from PHP?
>>>  Like Xs in Perl?
>>
>>By definition, then, all you have to do is learn how to write a PHP
>>extension, which Rasmus tells you how to do in a one-hour lecture at any
>>PHP/Linux/Apache/OpenSource conference you care to name :-)
>>
> 
> I downloaded php-4.3.10 off http://www.php.net/ and am trying to build a
> simple helloworld extension.
> 
> I ran ext_skel, modified config.m4 where it had the PHP_ARG_ENABLE line:
> 
> PHP_ARG_ENABLE(foo, whether to enable foo support,
> dnl Make sure that the comment is aligned:
> [  --enable-foo	Enable foo support])
> 
> I followed the remaining steps too, (./buildconf --force, ./configure
> --with-foo, make)
> 
> Now when I say
> ../sapi/cli/php -f ext/foo/foo.php
> 
> I get this error:
> 
> Warning: dl(): Unable to load dynamic library

Were you actually trying to dl() the library in your PHP code?  If you
compiled the extension into PHP this shouldn't be necessary.  In fact,
unless you build an extension to be a DSO you shouldn't be able to use
dl() with that extension anyways!

Mind you that I am no internals expert though... so this is about as
much help as I can give you.  :(

> '/usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so' -
> /usr/local/lib/php/extensions/no-debug-non-zts-20020429/foo.so: cannot
> open shared object file: No such file or directory in
> /home/deep/php-4.3.10/ext/foo/foo.php on line 3
> Functions available in the test extension:<br>
> 
> Warning: Invalid argument supplied for foreach() in
> /home/deep/php-4.3.10/ext/foo/foo.php on line 8
> <br>
> Module foo is not compiled into PHP
> [deep@deepak-linux php-4.3.10]$
> 
> I tried in vain to look up the Web for solutions, but to no avail.
> 
> Could anyone help me please?
> 
> Thanks,
> Deepak
> 


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux