$id = 'pagename'
$file = fopen($id . ".php") or die('An error occurred while creating the page');
$txt = '
<!-- Some HTML code... -->
';
fwrite($file, $txt);
fclose($file);
The script above does not create the file and instead returns “An error occurred while creating the page”.
Is there something wrong with my script? Or is there a restriction that does not allow PHP to create files?