The script is in myusername/public_html/item/index.php
code to save file:
$filename = $_SERVER['DOCUMENT_ROOT'].'/../data/guestbook.txt';
$filehandle = fopen($filename, 'ab+') or die("<p>Unable to create the file!</p>\n".$filename);
flock($filehandle, LOCK_EX) or die("<p>Unable to lock the file!</p>\n");
fwrite($filehandle, $new_entry) or die("<p>Unable to write to the file!</p>\n");
fclose($filehandle);
For some reason it fails on the fopen and the filename is actually ends up being literally with the /../ instead of navigating to the proper path.
What to do, what to do?
you can code like this if the php script is in the item folder and item and data are at the same level in the directory hierarchy
make sure apache user has the write access to the directory by “chown -R apache:apache” and “chmod 755”.
Probably the ” /../ ” in your code is giving the error. Try removing the first forward slash.