🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: de.comp.lang.php
6 messages
6 total messages Started by Herbert Rosmanith Fri, 16 Feb 2001 14:36
hilfe: extensions als .SO
#4
Author: Herbert Rosmanith
Date: Fri, 16 Feb 2001 14:36
76 lines
3733 bytes
hi,

ich versuche schon seit einiger zeit, eine php-extension zu
schreiben. das ist mir zwar gelungen, allerdings nur als
statisch gelinkte verison. ich haette aber gerne, um die
entwicklung zu beschleunigen (relinken von php braucht seine
zeit) dieses modul auch als .so bzw. dynamisch gelinkt.

obwohl ich mich strict an die anweisungen, die auf www.zend.com
stehen und die, die man erhaelt, wenn man das "ext_skel" aus-
fuehrt, gehalten habe, komme ich nicht weiter.

software: apache-1.3.14, php-4.0.4, als source, selbst compiled,
platform ist linux.

weder mit der automatischen installation  noch mit der manuellen
installtion (according to www.zend.com) komme ich weiter:

automatisch:

1) modul-subdir in ~/php-4.0.4/ext  erstellen.
2) config.m4 anpassen: "PHP_ARG_WITH" ist eingestellt.
3) buildconf laufen lassen
4) sh configure --with-<mein-modul>
5) make

nach schritt 5) erhalte ich in ~/php-4.0.4 ein php-binary,
in dem nsparse anscheinend schon statisch gelinkt ist:

    blau:~/php-4.0.4 # ldd php
            libpam.so.0 => /lib/libpam.so.0 (0x40018000)
            libdl.so.2 => /lib/libdl.so.2 (0x40020000)
            libresolv.so.2 => /lib/libresolv.so.2 (0x40023000)
            libm.so.6 => /lib/libm.so.6 (0x40032000)
            libcrypt.so.1 => /lib/libcrypt.so.1 (0x40050000)
            libnsl.so.1 => /lib/libnsl.so.1 (0x4007d000)
            libc.so.6 => /lib/libc.so.6 (0x40093000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
    blau:~/php-4.0.4 # strings php| grep nsparse
    php_info_nsparse
    ...
    nsparse
    confirm_nsparse_compiled
    ...

also stimmt da schon mal was nicht.

auch die manuelle installtion funktioniert nicht:

 : http://www.zend.com/...

  : Zend / Zend API Documentation / Extending PHP 4.0 / Creating Extensi (p7 of 9)
    : Compiling Manually. To compile your modules manually, you need the
    : following commands:

    : Compiling cc -fpic -DCOMPILE_DL=1 -I/usr/local/include -I. -I..
    : -I../Zend -c -o <your_object_file> <your_c_file>
    : Linking cc -shared -L/usr/local/lib -rdynamic -o <your_module_file>
    : <your_object_file(s)>


wenn ich "cc -shared -rdynamic -o nsparse.so *.o" eingebe und diese
modul in das htdocs verzeichnis stelle, dann bekomme ich beim aufruf
von ``dl("nsparse.so")'' folgenden fehler:

   Warning: Invalid library (maybe not a PHP library) 'nsparse.so' in
   /root/public_html/t-zone.php on line 2

pfuh. ich kaempfe schon seit 2 tagen mit diesem problem herum.

kann mir jemand sagen, wie man eine dynamisch gelinkte php-extension
erzeugen kann, sodass sie zur laufzeit mit dl() geladen werden
kann?

danke im voraus,
herbert
Re: hilfe: extensions als .SO
#5
Author: Herbert Rosmanith
Date: Fri, 16 Feb 2001 16:32
25 lines
1925 bytes
In at.linux Herbert Rosmanith <herp@wildsau.idv.uni-linz.ac.at> wrote:
>  : http://www.zend.com/...

>   : Zend / Zend API Documentation / Extending PHP 4.0 / Creating Extensi (p7 of 9)
>     : Compiling Manually. To compile your modules manually, you need the
>     : following commands:

>     : Compiling cc -fpic -DCOMPILE_DL=1 -I/usr/local/include -I. -I..
                           ^^^^^^^^^^^^^^

"ha-ha-ha"

>     : -I../Zend -c -o <your_object_file> <your_c_file>
>     : Linking cc -shared -L/usr/local/lib -rdynamic -o <your_module_file>
>     : <your_object_file(s)>


so, nach langem suchen (-> ext/standard/dl.c nachlesen)

was nirgends steht: man muss -DCOMPILE_DL_<MODULE_NAME>=1 setzen,
sonst verweigert "dl.c" das laden des .so-files. dl.c:DL_FETCH_SYMBOL()
verlangt nach einem eintrag "get_module", der durch genau diesen
switch mitcompiliert wird.

sehr witzig!!!
Re: hilfe: extensions als .SO
#6
Author: Alexander Griesser
Date: Fri, 16 Feb 2001 16:37
12 lines
1636 bytes
Herbert Rosmanith wrote in at.linux:
> so, nach langem suchen (-> ext/standard/dl.c nachlesen)
> sehr witzig!!!

Mir f�llt auf, dass du deine Fragen mit Vorliebe selbst beantwortest :)

Nix f�r ungut, alexx
-- 
|    .-.    |   CCNAIA Alexander Griesser <tuxx@aon.at>  |   .''`.  |
|    /v\    |          http://www.TUXX-HOME.org          |  : :' :  |
|  /(   )\  |         ICQ: 63180135 (__t|_|xx__)         |  `. `'   |
|   ^^ ^^   |     Linux Version 2.4.1 - Debian Woody     |    `-    |
Re: hilfe: extensions als .SO
#7
Author: King Leo (Martin Oberzalek)
Date: Fri, 16 Feb 2001 16:44
12 lines
1596 bytes
tuxx@aon.at (Alexander Griesser) writes:

> Herbert Rosmanith wrote in at.linux:
> > so, nach langem suchen (-> ext/standard/dl.c nachlesen)
> > sehr witzig!!!
> 
> Mir f�llt auf, dass du deine Fragen mit Vorliebe selbst beantwortest :)

Der beste Weg es zu lernen.

-- 
Even the smallest person can change the cause of the future.
Re: hilfe: extensions als .SO
#8
Author: Philipp E. Imhof
Date: Fri, 16 Feb 2001 17:00
10 lines
1527 bytes
> Der beste Weg es zu lernen.

Richtig. Und ausserdem "fair" gegen�ber der Gruppe. So k�nnen
alle davon profitieren, dass er ein Problem hatte und es nun
gel�st ist.

Danke, Herbert.

cu
fippu
Re: hilfe: extensions als .SO
#9
Author: Herbert Rosmanith
Date: Fri, 16 Feb 2001 18:00
8 lines
1505 bytes
In at.linux Alexander Griesser <tuxx@aon.at> wrote:
>> so, nach langem suchen (-> ext/standard/dl.c nachlesen)
>> sehr witzig!!!

> Mir f�llt auf, dass du deine Fragen mit Vorliebe selbst beantwortest :)

naja, ich poste ja nicht und sitze dann da und warte auf eine anwort,
sondern suche waehrenddessen natuerlich weiter.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads