homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

File being writen to the wrong directory.

 7:52 pm on Feb 5, 2008 (gmt 0)

Hi, I've been having problems writing to a text file on my server. I am using php to write the file. I have created a directory above my document root and I want to store a cache file in there. The problem I am having is that the file is still being writen to the document root even though I have defined the absolute path to where the file is supposed to go. I have no idea why this would happen. The php script can find the file but can't open it or read it. The permissions on the file are 775.

rehat linux.
apache 2.0.52
php 5.1.2



 9:14 pm on Feb 5, 2008 (gmt 0)

Ok I think I 've found what is causing the problem. "open_basedir restriction in effect". How do I fix this?


 1:29 am on Feb 6, 2008 (gmt 0)

This is a PHP issue, and a security measure - check out the
open_basedir entry here:

open_basedir string
Limit the files that can be opened by PHP to the specified directory-tree, including the file itself. This directive is NOT affected by whether Safe Mode is turned On or Off.

When a script tries to open a file with, 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

You should be able to add the path for the script to the list of allowed values.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved