How do I fix this PHP Permission error?

Cristian

New member
Alright on my website there's a snippet of code when a user clicks the submit button it will write some MySQL variables to a php file the error I get when it try to write to the file is


Warning: fopen(config.php) [function.fopen]: failed to open stream: Permission denied in /home/sulakesi/public_html/aPanel/index.php on line 39

My code is...
<? if (isset($_POST['step3'])) {
$begin = '<div align="right"><input type="submit" name="step4" value="Step 4" class="submit-btn" title="submit" /></div>';
$myFile = "config.php";
$fh = fopen($myFile, 'w') or die("Could not open config.php for writing! Please CHMOD this file to 777!");
$opening = 'mysql variables';
fwrite($fh, $opening);
$stringData = "mysql variables";
fwrite($fh, $stringData);
fclose($fh);
$work2 = "Config.php edited";
}
?>

Alright most of you are going to answer and say CHMOD it to 777 correct? The problem is I already have set the permissions of this file (index.php) to 777
 
Back
Top