[nycphp-talk] Error from PHP system function
Gary Mort
bz-gmort at beezifies.com
Fri Nov 30 17:35:20 EST 2007
Nelly Yusupova wrote:
> Here is the command that I'm trying to execute.....
>
> system ("/usr/bin/wget -P/tmp --post-data
> 'subscribees=$email&adminpw=$password&send_welcome_msg_to_this_batch=0&send_
> notifications_to_list_owner=0'
> http://www.emdrhap.org/mailman/admin/$list/members/add", $returnval);
>
Try the following:, courtesy of php.net
|<?php
$filename = '/tmp/test.txt';
$somecontent = "Add this to the file\n";
// In our example we're opening $filename in write mode.
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
?> |
Yeah yeah, any process should be able to write to files in the tmp
folder, but I've had systems where that is not the case(running *bsd by
any chance?)
More information about the talk
mailing list