|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22954 /usr/bin/sendmail: error while loading shared libraries:
Submitted: 2003-03-29 13:07 UTC Modified: 2003-03-30 18:53 UTC
From: mclinden at informed dot net Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.3.1 OS: Linux 2.4.20
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mclinden at informed dot net
New email:
PHP Version: OS:


 [2003-03-29 13:07 UTC] mclinden at informed dot net
Compiled PHP with --with-oci8=/usr/oracle/OraHome1 ...
Oracle 9.2
Apache 2.43

PHP compiles fine. Application works fine (all pages are dynamically created using Oracle and PHP) EXCEPT the mail function fails with Apache error log message:

/usr/sbin/sendmail: error while loading shared libraries:" cannot open shared object file: No such file or directory.

sendmail works fine when called at the command line
apache/oci/etc configured according to PHP documentation (as I said, ALL other Oracle accesses work perfectly)

Thanks in advance


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-29 20:07 UTC]
(1) What version of sendmail are you running?  (Are you even running sendmail? or a sendmail compatable MTA?)

(2) When you say "Sendmail runs fine from the command line" are you passing a full email on stdin using the same command line switches as specified in your php.ini?

Does exist anywhere on your system ( try: `find / -name -print` ).  Does the path where that file is located exist in your /etc/ ?  If you've just added it did you remember to run `ldconfig`?

In any event, this is a sendmail problem and not a PHP one as PHP does not use libclntsh itself.
 [2003-03-30 09:23 UTC] mclinden at informed dot net
I am running sendmail version 8.12.7. When I say that I can run it from the command line I mean that if I execute at the command line the value of sendmail_path from php.ini, it works fine. In fact, if I do an ldd on sendmail it doesn't even NEED

Yes, exists in $ORACLE_HOME/lib and I added it to the LD_PRELOAD environment variable for Apache.

As I said, all other services based upon PHP-Oracle work fine except the mail command.
 [2003-03-30 10:32 UTC]
Try the following script (which mimicks the core of mail()'s functionality) and reply with what is returned:

  $fd = array(0=>array('pipe','r'),1=>array('pipe','w'),2=>array('file','proc-open.error.log','w'));

  var_dump($pid = proc_open(ini_get('sendmail_path'), $fd, $fp));

  /* Replace this with a mail address you have access to */
  fwrite($fp[0],'Subject: This is a test. ' . date("n/j/Y H:i:s") . "\r\n\r\n");
  fwrite($fp[0],"This is only a test.\r\n");

  while (!feof($fp[1]))
    echo fgets($fp[1]);


  echo "---------------\nEnd of script\n------------\n";

 [2003-03-30 11:07 UTC] mclinden at informed dot net
The mail is successfully sent. At the command prompt I get:

resource(7) of type (process)

I did NOT compile php with --with-oci8=shared,/usr/oracle/OraHome1 (well, I did, but then PHP complained that the OCI functions were undefined).

This may be more related to apache than PHP, though I cannot think of why.
 [2003-03-30 14:43 UTC]
Well then, let's try taking Apache out of the equation.

Use the CLI version of PHP (which should have been built along with the Apache DSO module, unless you explicitly specified --without-cli) with a simple mail script:

  mail('','This is another test','Still just a test.');
 [2003-03-30 14:47 UTC] mclinden at informed dot net
Sorry for the confusion. The last output WAS from the CLI. This is the output from the page served up by Apache.

resource(5) of type (process) 
--------------- End of script ------------/usr/sbin/sendmail: error while loading shared libraries: cannot open shared object file: No such file or direct
 [2003-03-30 18:53 UTC]
I can't see this as anything but a non-PHP related error at this point.

It's *really* odd that the error only occurs when a fork is issued, though that may be an artifact of the way in which Apache2 handles children.

I'd say spend some time working with the apache configuration file, paying particular attention to the use of LD_PRELOAD which you mentioned you're using.

In any event, the fact that the exact same script works under CLI but not under Apache DSO is very suggestive.
 [2003-07-15 07:53 UTC] thomas at abstraktgraphics dot com
I had the same problem
with any PHP/Oracle version (since 4.0.6 or oracle 8,9,9.2)
Actually it's not directly related to php/oracle.

Here is the trick that solve the probleme:

Since i use he Apache server included with Oracle distribution i couldnt re-compile it myself.
So Oracle apache needs tweking of apachectl start file in order to suport php as a dso.

it needs LD_PRELOAD of AND since it's not compiled with libpthread ...


since u're asking a LD_PRELOAD of libclntsh this library will be needed by any programs runed by apache.
so sendmail when lunched by apache will inherit the needs of, this problems is not specific to "sendmail" but to most binary run from apache.

Curiously for this to works you need to ld_preload the FULL PATH of the libs and not relaying on the library being in som environement PATH.
Olso for me it worked after symlinking my oracle lib (in $ORACLE_HOME) to /usr/lib/ or som well knowns libs path and not directlly of oracle home, even with fullpath (maybe a prob).

Hope this will help fixing u're probleme
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Feb 04 00:03:40 2023 UTC