I'm using the following code to create a file:
$mainopen = fopen ($filename, 'wb');
chmod($filename, 0777);
fwrite ($mainopen, "text\n");
This has worked for me in the past, however now I'm receiving the following errors:
Warning: SAFE MODE Restriction in effect. The script whose uid is 546 is not allowed to access /home/virtual/site38/fst/var/www/html/gallery owned by uid 48 in /home/virtual/site38/fst/var/www/html/backoffice/admin.php on line 55
Warning: fopen("/home/virtual/site38/fst/var/www/html/gallery/megan.htm", "wb") - No such file or directory in /home/virtual/site38/fst/var/www/html/backoffice/admin.php on line 55
Warning: Unable to access /home/virtual/site38/fst/var/www/html/gallery/megan.htm in /home/virtual/site38/fst/var/www/html/backoffice/admin.php on line 56
Warning: chmod failed: No such file or directory in /home/virtual/site38/fst/var/www/html/backoffice/admin.php on line 56
This is followed by a ton of other permission errors. However, the directory gallery has a chmod of 777. Any ideas how to correct this?