Jump to content

Recommended Posts

i assume you mean opendir

Opens up a directory handle to be used in subsequent closedir(), readdir(), and rewinddir() calls.

 

<?php
$dir = "/etc/php5/";

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
        }
        closedir($dh);
    }
}
?>

Link to comment
https://forums.phpfreaks.com/topic/104192-open_basedir/#findComment-533383
Share on other sites

Sorry I Totally missed the point of your post!

 

okay the directive  open_basedir, is used as a restriction,

 

When a script tries to open a file with' date=' for example, fopen() or gzopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink. If the file doesn't exist then the symlink couldn't be resolved and the filename is compared to (a resolved) open_basedir .[/quote']

 

Link to comment
https://forums.phpfreaks.com/topic/104192-open_basedir/#findComment-533391
Share on other sites

yes, its not a path it's a prefix, like a regex "^/dir/inc"

The restriction specified with open_basedir is actually a prefix, not a directory name. This means that "open_basedir = /dir/incl" also allows access to "/dir/include" and "/dir/incls" if they exist. When you want to restrict access to only the specified directory, end with a slash. For example: "open_basedir = /dir/incl/"

Link to comment
https://forums.phpfreaks.com/topic/104192-open_basedir/#findComment-533397
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.