the issue that I'm having is with the fopen(), fwrite(), and fclose() function. This is the error I am receiving:
Warning: fopen(/db-backup-salisbury_school-20121128-021138.sql) [function.fopen]: failed to open stream: Permission denied in C:\inetpub\wwwroot\omarejaz\sbyschool\q5.php on line 177
Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\inetpub\wwwroot\omarejaz\sbyschool\q5.php on line 178
Warning: fclose() expects parameter 1 to be resource, boolean given in C:\inetpub\wwwroot\omarejaz\sbyschool\q5.php on line 179
The code for this portion of php can be found below any help would be greatly appreciated!
* Save SQL to file
* @param string $sql
*/
protected function saveFile(&$sql, $outputDir = '.')
{
if (!$sql) return false;
try
{
$handle = fopen($outputDir.'/db-backup-'.$this->dbName.'-'.date("Ymd-His", time()).'.sql','w+');
fwrite($handle, $sql);
fclose($handle);
}
catch (Exception $e)
{
var_dump($e->getMessage());
return false;
}
return true;
}
}
?>
No comments:
Post a Comment