|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-13 23:31 UTC] rherror404 at gmail dot com
Description: ------------ Hitting this script with two concurrent requests causes a failure of both, each reporting different errors. $ (curl "http://192.168.1.2/error.php" &); (curl "http://192.168.1.2/error.php" &) $ Warning: mail(): SMTP server response: 503 5.0.0 foo.bar.com Duplicate HELO/EHLO in C:\Program Files\Apache Group\Apache2\htdocs\error.php on line 107 FALSE Warning: mail(): Failed to Receive in C:\Program Files\Apache Group\Apache2\htdocs\error.php on line 107 FALSE $ Reproduce code: --------------- <? define('EXTRAHEADERS', "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nX-Mailer: PHP\r\n"); define('MAILMSG', "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"> <html><head><title>foo</title><style type='text/css'> body {margin: 0; font-size: 10pt; font-family: sans-serif, arial; color: #000000; background-color: #ffffff;} </style></head><body><div style='font-size: 12pt; background-color: #ffff00;'>" . date("Y-m-d H:i:s") . "</div> random junk<br />" . str_repeat("afhlkhsad;lfj;lkjsa;lfjasd;lkjf;lkjsad;lkfjsad;lkfjsad;lkfjasd;lfkjasd;lkfjsa;ldf<br />\n", 100) . "</body></html>"); ini_set('html_errors', FALSE); ini_set('SMTP', '10.1.2.3'); // valid address for a SMTP relay ini_set('sendmail_from', 'foo <do_not_reply@foo123.com>'); // fake address define('MAILTO', 'something@thatworks.com'); // something real $retval = mail(MAILTO, 'foo', MAILMSG, EXTRAHEADERS); echo ( $retval ? 'TRUE' : 'FALSE' ). "\n\n\n"; exit(); ?> Expected result: ---------------- If I run multiple concurrent requests, then I expect to get multiple emails, one for each request. Actual result: -------------- The little shell command where I run two HTTP requests (using cURL in a Cygwin bash) concurrently causes a failure of both, each reporting different errors. It runs fine otherwise. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 12:00:01 2025 UTC |
<? /* Here it is again, edited slightly to run on a Linux machine so that it has its local sendmail do the work. Concurrent requests to the script were handled quite nicely. The huge difference in this case is the Apache prefork MPM. */ define('EXTRAHEADERS', "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nX-Mailer: PHP\r\n"); define('MAILMSG', "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"> <html><head><title>foo</title><style type='text/css'> body {margin: 0; font-size: 10pt; font-family: sans-serif, arial; color: #000000; background-color: #ffffff;} </style></head><body><div style='font-size: 12pt; background-color: #ffff00;'>" . date("Y-m-d H:i:s") . "</div> random junk<br />" . str_repeat("afhlkhsad;lfj;lkjsa;lfjasd;lkjf;lkjsad;lkfjsad;lkfjsad;lkfja sd;lfkjasd;lkfjsa;ldf<br />\n", 100) . "</body></html>"); ini_set('html_errors', FALSE); define('MAILTO', 'something@thatworks.com'); // something real $retval = mail(MAILTO, 'foo', MAILMSG, EXTRAHEADERS); echo ( $retval ? 'TRUE' : 'FALSE' ) . "\n\n\n"; exit(); ?>