ID: 28748 User updated by: karthur at kzoo dot edu Reported By: karthur at kzoo dot edu Status: Wont fix -Bug Type: iPlanet related +Bug Type: Feature/Change Request Operating System: Solaris 8 PHP Version: 4.3.6 New Comment:
Here's a solution that appears to work for us so far. It might be nice if the php developers would consider a --with-sfio parameter in configure that took care of this. Our exec command is still broken so I'll probably have to do this same type of thing for that. 1. install sfio from AT*T 2. setenv LIBS "-L/usr/local/lib/sfio -lsfio" 3. modify ext/standard/mail.c 4. modify /usr/local/include/sfio/sfio.h so references to other sfio header files are absolute paths (if I use -I/usr/local/include/sfio to find the files it produces errors for files other than mail.c) 5. run configure and compile as normal here's a diff or my code and the original mail.c: diff mail.c mail.c.orig 23c23 < #include </usr/local/include/sfio/sfio.h> --- > #include <stdio.h> 177c177 < Sfio_t *sendmail=NULL; --- > FILE *sendmail; 215c215 < sendmail = sfpopen(sendmail, sendmail_cmd, "w"); --- > sendmail = popen(sendmail_cmd, "w"); 224c224 < sfclose(sendmail); --- > pclose(sendmail); 228,229c228,229 < sfprintf(sendmail, "To: %s\n", to); < sfprintf(sendmail, "Subject: %s\n", subject); --- > fprintf(sendmail, "To: %s\n", to); > fprintf(sendmail, "Subject: %s\n", subject); 231c231 < sfprintf(sendmail, "%s\n", headers); --- > fprintf(sendmail, "%s\n", headers); 233,234c233,234 < sfprintf(sendmail, "\n%s\n", message); < ret = sfclose(sendmail); --- > fprintf(sendmail, "\n%s\n", message); > ret = pclose(sendmail); Previous Comments: ------------------------------------------------------------------------ [2004-06-14 18:39:17] papercrane at reversefold dot com If you continue to have this problem, you may want to look into a package which implements mailing in PHP code, such as: http://pear.php.net/package/Mail ------------------------------------------------------------------------ [2004-06-14 15:44:16] karthur at kzoo dot edu Thanks for the quick feedback. However, we have a similar problem with exec so the suggested work-around won't help. I'm going to try to rewrite mail.c to use sfio from AT&T. The downside is that I'll then have to reimplement that fix everytime we upgrade php. I can share the code I come up with if anyone is interested. If it does work, then I'll try to look more into the exec function as well. If it doesn't work then another work-around I thought of is to have php write the email to a file and then have a cron-scheduled system script pass the file off to sendmail. ------------------------------------------------------------------------ [2004-06-12 22:31:45] [EMAIL PROTECTED] This problem is well known and a problem of Solaris in all versions. For PHP 4.3.4 we ported a lot of code from PHP5 back to eliminate fopen(),... Scripts now start without any problems (until PHP 4.3.3 even this could fail). But there are still a lot of extensions that use stdio functions. A solution would be to write a temporary file with the complete mail (headers and text) and then execute: exec("/bin/sh -c \"/usr/lib/sendmail -t </tmp/mail.txt\""). ------------------------------------------------------------------------ [2004-06-12 19:07:13] karthur at kzoo dot edu Upon further searching this sounds like bug report 25195 which had no solution given. Any chance someone has discovered a work-around for this? ------------------------------------------------------------------------ [2004-06-11 23:40:17] karthur at kzoo dot edu Description: ------------ mail() stops working a few minutes after Sunone 6 web server starts, which makes this look like a resource problem... Config line: "./configure --with-mysql=/usr/local/mysql --with-nsapi=/home/netscape/servers --enable-track-vars --enable-libgcc --with-ldap" Note that mail() does work briefly after web server is restarted so it doesn't seem to be a configuration problem. Reproduce code: --------------- <?php mail("[EMAIL PROTECTED]", "Test Subject", "Test Body"); ?> Expected result: ---------------- expect to receive an email Actual result: -------------- no email received I get no php or system errors but the following error shows up in the IPlanet logs: "trying to GET /is/sys net/test/email.php, php4_execute reports: PHP Warning: mail(): Could not execute mail delivery program '/usr/lib/sendmail -t'" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28748&edit=1