Jump to content

[SOLVED] Permission denied... on localhost.


blueman378

Recommended Posts

hi guys, im using a windows machine xp.

 

im trying to write some code to include all files from a directory.

 

so i have my index.php

i also have a directory called plugins.

 

heres my code:

<?php if ($handle = opendir('plugins/')) {
echo "<!--included plugins:-->";
    while (false !== ($file = readdir($handle))) {
    	if($file != "." && $file != "..")
        echo "<!--$file-->\n";
        include_once("plugins/$file");
?>
    }

 

but im getting:

Warning: include_once(plugins\.) [function.include-once]: failed to open stream: Permission denied in C:\wamp\www\Smarty Forum\index.php on line 76

Warning: include_once() [function.include]: Failed opening 'plugins\.' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\Smarty Forum\index.php on line 76

Warning: include_once(plugins\..) [function.include-once]: failed to open stream: Permission denied in C:\wamp\www\Smarty Forum\index.php on line 76

Warning: include_once() [function.include]: Failed opening 'plugins\..' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\Smarty Forum\index.php on line 76

 

any ideas?

Link to comment
Share on other sites

You're trying to include . (because your if statement doesn't have brackets) which is causing the problem.

 

       if($file != "." && $file != "..")
        echo "<!--$file-->\n";
        include_once("plugins/$file");

 

should be

 

       if($file != "." && $file != "..") {
        echo "<!--$file-->\n";
        include_once("plugins/$file");
       }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.