Actually I tried a simple test case and this doesn't work at all. PHP waits for the second file to complete. Here's how I tested it:
File 1 [[ test.php ]] (accessed via browser):
<?php
$f = popen( './mailantun.php' , 'w' );
fputs( $f, 'very smelly' );
pclose( $f );
echo 'test';
exit;
?>
File 2 [[ mailantun.php ]] (accessed via popen() from first file):
#!/usr/bin/php
<?php
$myname = 'antun';
$myemail = 'antun@antunkarlovac.com';
$contanctname = 'Antun';
$contactemail = 'antun@laszlosystems.com';
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
// I'm delaying this on purpose for 5 seconds
sleep( 5 );
mail( $contactemail, 'DEBUG', 'testing...' . $passedval, $headers );
exit;
?>
So I don't think this will work with PHP - might have to try a shell script instead...
-Antun
Originally posted by mmilano
if php is installed as an inturpriter ( sp? ), it can be executed as a script. ./somescript.php