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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: drew at elysium dot ltd dot uk
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 21:01:34 2025 UTC