This is my code:
$dir = "/var/www/html/";
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
$new_file = fopen("ada", "w", "666");
fwrite($new_file, 'Text');
fclose($new_file);
}
}
closedir ($dh);
}
however, I got errors stating:
Warning: fopen(ada): failed to open stream: Permission denied in /var/www/html/process_index.php on line 14 (highlighted)
I understand it is something to do with my file permission so, what i did was I gave all permission to all my directories...
chmod a=r+w+x /var/
chmod a=r+w+x /www/
chmod a=r+w+x /html/
however, when I run the script, the errors are still there.
is there anything else that I have missed out?