Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error: open_basedir restriction in effect

    Hi,

    I have created a website that works fine, but when I try creating an image gallery I get this error message on the page for each image:

    Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/media/Galleri3//AdamBskud.jpg) is not within the allowed path(s): (/var/www/vhosts/4601.linux7.testsider.dk/httpdocs:/tmp) in /var/www/vhosts/4601.linux7.testsider.dk/httpdocs/modules/foldergallery/view.php on line 343

    I found this link, but I don't really understand what I should do:
    http://www.websitebaker.org/forum/in...968.0%253Bwap2

    And would this work?

    I hope someone can help.

    Thank you.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Your current configurations only allow you to open the two directories specified in the open_basedir directive. Your only option is to configure the open_basedir directive, either yourself if you have the permissions (with php.ini or .htaccess) or have your host change it if you are shared.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh ok, thank you for your reply.
    I'm pretty sure I don't have the permissions to change php.ini or .htaccess.
    That makes sence if I'm using a hosting company right?

    So when I call the hosting company to ask if they can change those files, do you know what exactly I have to ask them to change?

    Thank you

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Ask to have the open_basedir restriction removed. Unless of course your filepath is wrong; I don't know where the /media directory would have been created, but its not a default linux filesystem directory despite being hung off of the filesystem root. You sure that path exists?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just spoke to the hosting company and they said I should delete / in front of media. because it's trying to access a folder I don't have access to.

    However I can't find the /media in any files, do you know if it would just be the / written or what file it might be in?

    Thank you.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    No I haven't a clue what your filesystem paths look like. All I can say is that /media is a directory immediately off of the filesystem root, whilst removing / would then become a directory called media that is child to the current working path. This is why I always suggest making use of magic constants in PHP for filesystem paths and working relative from them. This differs from HTML which is jailed to the site root, so I can legally use a <img src="/media/myimage.jpg" alt="an image"/> in HTML since that would refer to mysite.com/media/myimage.jpg. In PHP that wouldn't. To do the same, it'd be under $_SERVER['DOCUMENT_ROOT'] . '/media/myimage.jpg', but I don't recommend the use of $_SERVER in any path dereferencing (since it won't work from the command line). Instead, if my file is located in $_SERVER['DOCUMENT_ROOT'] (which is your /var/www/vhosts/{user}/httpdocs path), in that file I would use __DIR__ . '/media/myimage.jpg'; which then resolves to /var/www/vhosts/{user}/httpdocs/media/myimage.jpg. If you need to go up, you simply add that in relative with [icode]__DIR__ . '/../media/myimage.jpg';[icode] which puts me at /var/www/vhosts/{user}/media/myimage.jpg.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm ok, I'm sorry, i'm quite new at this, so I don't really understand so much of it.

    Could you maybe specify, where I should put/write what?
    Or what info should I give you so you would know how my system paths look like?

    I hope you can help.

    Thank you


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •