Page 1 of 1

mail() and concurrent access

Posted: Tue Nov 09, 2010 8:45 pm
by jbenezech
Hi All,

I don't know much about PHP and am trying to debug some code for a friend.
We found a strange issue related to concurrent access of a php script related to a payment system.

The code does the following:

Code: Select all

$fp=fopen($logfile, "a");
fwrite($fp, "calling binary with params: $parm\n");

$headers = 'From: from@company.com';
$mailbody = "$path_bin $parm";
$ret = mail('to@company.com','transaction log',$mailbody, $headers);

$result=exec("$path_bin $parm");
It seems that 2 users accessed our payment system at the same time but only one of them (the second one) went through. Events look like:

calling binary with params (user1)
calling binary with params (user2)

email transaction log (user 1 or user2 unknown yet)

exec only on user2

-----------------

So I was wondering if there could be a concurrent access issue with variables of user1 being replaced by variables of user2. I don't know much about variable scope in php.
Other possibility is that the mail() function does not support concurrent access and somehow died for 1 of the transaction.


Appreciate your help

Jerome