#19937 [Com]: dynamic extension loading fails

2009-05-01 Thread spannothanks at example dot com/span
 ID:   19937
 Comment by:   spannothanks at example dot com/span
 Reported By:  ryan dot smith at openwave dot com
 Status:   No Feedback
 Bug Type: Dynamic loading
 Operating System: AIX 5.1
 PHP Version:  4.3.0-dev
 New Comment:

bThanks/b for this!


Previous Comments:


[2008-09-23 11:57:44] eilaf_mugbil at hotmail dot com

eilaf



[2006-04-21 07:04:45] jens_0 at hotmail dot com

Same thing here with Apache/1.3.31 (Unix)  PHP/4.0.6 using HP-UX or AIX
concening libgd.so.
The extension won't load:
PHP Warning:  Unable to load dynamic library
'/usr/local/lib/php/extensions/no-debug-non-zts/libgd.so' - Invalid
argument in Unknown on line 0



[2003-07-18 18:49:39] sni...@php.net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.





[2003-07-10 18:08:00] sni...@php.net

Here's an url to it:

http://www.php.net/~jani/dlopen_patch.txt




[2003-07-10 18:05:55] sni...@php.net

Could you try this patch:

Index: zend.h
===
RCS file: /repository/Zend/Attic/zend.h,v
retrieving revision 1.164.2.8
diff -u -r1.164.2.8 zend.h
--- zend.h  31 May 2003 01:37:43 -  1.164.2.8
+++ zend.h  10 Jul 2003 23:05:38 -
@@ -89,7 +89,11 @@
 #  define RTLD_GLOBAL 0
 # endif
 
-# define DL_LOAD(libname)  dlopen(libname,
RTLD_LAZY | RTLD_GLOBAL)
+# ifndef RTLD_PARENT
+#  define RTLD_PARENT 0
+# endif
+
+# define DL_LOAD(libname)  dlopen(libname,
RTLD_LAZY | RTLD_GLOBAL | RTLD_PARENT)
 # define DL_UNLOAD dlclose
 # if DLSYM_NEEDS_UNDERSCORE
 #  define DL_FETCH_SYMBOL(h,s) dlsym((h), _ s)




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/19937

-- 
Edit this bug report at http://bugs.php.net/?id=19937edit=1



#19937 [Com]: dynamic extension loading fails

2008-09-23 Thread eilaf_mugbil at hotmail dot com
 ID:   19937
 Comment by:   eilaf_mugbil at hotmail dot com
 Reported By:  ryan dot smith at openwave dot com
 Status:   No Feedback
 Bug Type: Dynamic loading
 Operating System: AIX 5.1
 PHP Version:  4.3.0-dev
 New Comment:

eilaf


Previous Comments:


[2006-04-21 07:04:45] jens_0 at hotmail dot com

Same thing here with Apache/1.3.31 (Unix)  PHP/4.0.6 using HP-UX or AIX
concening libgd.so.
The extension won't load:
PHP Warning:  Unable to load dynamic library
'/usr/local/lib/php/extensions/no-debug-non-zts/libgd.so' - Invalid
argument in Unknown on line 0



[2003-07-18 18:49:39] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.





[2003-07-10 18:08:00] [EMAIL PROTECTED]

Here's an url to it:

http://www.php.net/~jani/dlopen_patch.txt




[2003-07-10 18:05:55] [EMAIL PROTECTED]

Could you try this patch:

Index: zend.h
===
RCS file: /repository/Zend/Attic/zend.h,v
retrieving revision 1.164.2.8
diff -u -r1.164.2.8 zend.h
--- zend.h  31 May 2003 01:37:43 -  1.164.2.8
+++ zend.h  10 Jul 2003 23:05:38 -
@@ -89,7 +89,11 @@
 #  define RTLD_GLOBAL 0
 # endif
 
-# define DL_LOAD(libname)  dlopen(libname,
RTLD_LAZY | RTLD_GLOBAL)
+# ifndef RTLD_PARENT
+#  define RTLD_PARENT 0
+# endif
+
+# define DL_LOAD(libname)  dlopen(libname,
RTLD_LAZY | RTLD_GLOBAL | RTLD_PARENT)
 # define DL_UNLOAD dlclose
 # if DLSYM_NEEDS_UNDERSCORE
 #  define DL_FETCH_SYMBOL(h,s) dlsym((h), _ s)




[2003-05-02 06:51:16] francois dot turi at globecast dot com

The following patch should fix problem of loading extension under AIX
4.3.3 like the java extension.

Under AIX, shared object are different from shared library.
The default library construction (as in the construction of
the JAVA extension) doesnt work correctly as it relies on dynamic
linking from a library when only a shared object is given.
An exception appear as illegal instruction.

The following configuration are missing:

First of all:
=
 one should construct correctly the export definition of libphp4.so.
In configure the following line should be changed:


diff configure configure.orig (sorry no -b available under AIX)
78084,78086c78084
 # FTU export_symbols_cmds='$NM $libobjs $convenience |
$global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq 
$export_symbols'
 export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe
| sed '\''s/.* //'\'' | sort | uniq|awk -vlib=$SOHOME/$soname
 '\''BEGIN{printf #!%s\n,lib}{print \$0}'\''  $export_symbols'
 echo FTU export_symbols_cmds=$export_symbols_cmds
---
 export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe
| sed '\''s/.* //'\'' | sort | uniq  $export_symbols'
***


I added awk -vlib=$SOHOME/$soname 
 '\''BEGIN{printf #!%s\n,lib}{print \$0}'\'' 
To the pipe so the first line will be read as:
#!/your/path/to/your/libphp4.so

And the rest is identical.
Before compiling your library you should setup the SOHOME variable as
the path where your shared object (libphp4.so.0) will be running:


 export SOHOME=/s00/opendata/build/SSOD/php.430/current


Second important point:

Refer the export file of php shared object in the construction of the
java extension:
When compiling the JAVA extension you have to setup the following
environement VARIABLE

*
export JAVA_SHARED_LIBADD=-Wl,-bI:.libs/libphp4.exp
*

That line state that in the linking process (ld), the java extension
will use the libphp4.exp file to find undefined function or global
variable. By defaut such function will be resolve as running time.
On AIX such binding doesnt work because the libphp4.so is not a shared
library (doesnt appear in the genmkd listing) but a share object.
You have to specify the full path to your share object while linking it
to make him resolve correctly the reference to the Zend API.


Nota: the default exemple given to make an extension doesnt have that
problem because it doesnt call any Zend API function stored in the
libphp4.so.

External reference:
The followings redbooks explain the subtle difference between share
objects and shared library under AIX:
Understanding 

#19937 [Com]: dynamic extension loading fails

2006-04-21 Thread jens_0 at hotmail dot com
 ID:   19937
 Comment by:   jens_0 at hotmail dot com
 Reported By:  ryan dot smith at openwave dot com
 Status:   No Feedback
 Bug Type: Dynamic loading
 Operating System: AIX 5.1
 PHP Version:  4.3.0-dev
 New Comment:

Same thing here with Apache/1.3.31 (Unix)  PHP/4.0.6 using HP-UX or AIX
concening libgd.so.
The extension won't load:
PHP Warning:  Unable to load dynamic library
'/usr/local/lib/php/extensions/no-debug-non-zts/libgd.so' - Invalid
argument in Unknown on line 0


Previous Comments:


[2003-07-18 18:49:39] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.





[2003-07-10 18:08:00] [EMAIL PROTECTED]

Here's an url to it:

http://www.php.net/~jani/dlopen_patch.txt




[2003-07-10 18:05:55] [EMAIL PROTECTED]

Could you try this patch:

Index: zend.h
===
RCS file: /repository/Zend/Attic/zend.h,v
retrieving revision 1.164.2.8
diff -u -r1.164.2.8 zend.h
--- zend.h  31 May 2003 01:37:43 -  1.164.2.8
+++ zend.h  10 Jul 2003 23:05:38 -
@@ -89,7 +89,11 @@
 #  define RTLD_GLOBAL 0
 # endif
 
-# define DL_LOAD(libname)  dlopen(libname,
RTLD_LAZY | RTLD_GLOBAL)
+# ifndef RTLD_PARENT
+#  define RTLD_PARENT 0
+# endif
+
+# define DL_LOAD(libname)  dlopen(libname,
RTLD_LAZY | RTLD_GLOBAL | RTLD_PARENT)
 # define DL_UNLOAD dlclose
 # if DLSYM_NEEDS_UNDERSCORE
 #  define DL_FETCH_SYMBOL(h,s) dlsym((h), _ s)




[2003-05-02 06:51:16] francois dot turi at globecast dot com

The following patch should fix problem of loading extension under AIX
4.3.3 like the java extension.

Under AIX, shared object are different from shared library.
The default library construction (as in the construction of
the JAVA extension) doesnt work correctly as it relies on dynamic
linking from a library when only a shared object is given.
An exception appear as illegal instruction.

The following configuration are missing:

First of all:
=
 one should construct correctly the export definition of libphp4.so.
In configure the following line should be changed:


diff configure configure.orig (sorry no -b available under AIX)
78084,78086c78084
 # FTU export_symbols_cmds='$NM $libobjs $convenience |
$global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq 
$export_symbols'
 export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe
| sed '\''s/.* //'\'' | sort | uniq|awk -vlib=$SOHOME/$soname
 '\''BEGIN{printf #!%s\n,lib}{print \$0}'\''  $export_symbols'
 echo FTU export_symbols_cmds=$export_symbols_cmds
---
 export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe
| sed '\''s/.* //'\'' | sort | uniq  $export_symbols'
***


I added awk -vlib=$SOHOME/$soname 
 '\''BEGIN{printf #!%s\n,lib}{print \$0}'\'' 
To the pipe so the first line will be read as:
#!/your/path/to/your/libphp4.so

And the rest is identical.
Before compiling your library you should setup the SOHOME variable as
the path where your shared object (libphp4.so.0) will be running:


 export SOHOME=/s00/opendata/build/SSOD/php.430/current


Second important point:

Refer the export file of php shared object in the construction of the
java extension:
When compiling the JAVA extension you have to setup the following
environement VARIABLE

*
export JAVA_SHARED_LIBADD=-Wl,-bI:.libs/libphp4.exp
*

That line state that in the linking process (ld), the java extension
will use the libphp4.exp file to find undefined function or global
variable. By defaut such function will be resolve as running time.
On AIX such binding doesnt work because the libphp4.so is not a shared
library (doesnt appear in the genmkd listing) but a share object.
You have to specify the full path to your share object while linking it
to make him resolve correctly the reference to the Zend API.


Nota: the default exemple given to make an extension doesnt have that
problem because it doesnt call any Zend API function stored in the
libphp4.so.

External reference:
The followings redbooks explain the subtle difference between share
objects and shared library under AIX:
Understanding C and C++ development on AIX
chapter 3 Compiling and Linking

original
http://www.redbooks.ibm.com/pubs/pdfs/redbooks/sg245674.pdf