mail() and concurrent access

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jbenezech
Forum Newbie
Posts: 1
Joined: Tue Nov 09, 2010 8:34 pm

mail() and concurrent access

Post 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
Post Reply