Reputation: 41219
I am getting the following php warning when using the scandir() function :
Scandir failed to open dir: opration not permitted in public_html/page2.php on line 3
page2.php
<?Php
$folder="/";
$result=scandir($folder);
print_r($result);
I want to use this function to print the files and sub directories of my root folder but it's not working.
Does someone know how to fix it?
Upvotes: 0
Views: 1912
Reputation: 27618
Because you're trying to scan a directory that you don't have permissions to do (in this case the root directory /
).
Either change the permissions, or scan a directory you do have permissions for.
This may either be on a directory permissions basis, or using the open_basedir
directive.
Upvotes: 2