php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3956 Does not load a library
Submitted: 2000-03-29 07:54 UTC Modified: 2000-03-30 07:57 UTC
From: drew at elysium dot ltd dot uk Assigned:
Status: Closed Package: Dynamic loading
PHP Version: 4.0 Beta 4 Patch Level 1 OS: RH6.1 Intel
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
28 - 3 = ?
Subscribe to this entry?

 
 [2000-03-29 07:54 UTC] drew at elysium dot ltd dot uk
php.ini :-
extension_dir = /usr/lib/apache

extension = pgsql.so

After starting Apache, the following error appears in the error_log for Apache :-
PHP Fatal error: Unable to load dynamic library '/usr/lib/apache/mysql.so!' - /usr/lib/apache/mysql.soA :No such file or directory in Unknown on line 0

The thing I noticed was the added ! and A on the library name in the error_log, it turns out it is related to the fact the extension_dir in php.ini has not got a trailing / so the emalloc for libpath in dl.c is wrong in this instance, the emalloc has a +1 for the 0 terminator but not any spare space for the / added in the sprintf so the fix is to change the +1 to +2, or apply the following patch :-

(Note this bug is still there in RC1)

--- php-4.0RC1/ext/standard/dl.c.orig   Wed Mar 29 13:34:49 2000
+++ php-4.0RC1/ext/standard/dl.c        Wed Mar 29 13:35:03 2000
@@ -88,7 +88,7 @@
                && PG(extension_dir)[0]){
                int extension_dir_len = strlen(PG(extension_dir));

-               libpath = emalloc(extension_dir_len+file->value.str.len+1);
+               libpath = emalloc(extension_dir_len+file->value.str.len+2);

                if (PG(extension_dir)[extension_dir_len-1]=='/' || PG(extension_dir)[extension_dir_len-1]=='\\') {
                        sprintf(libpath,"%s%s",PG(extension_dir),file->value.str.val);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-03-30 07:57 UTC] sas at cvs dot php dot net
Fixed in CVS. Thanks for your patch!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 08:01:30 2024 UTC