Text file being writen to the wrong directory.

  • steven420
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 16, 2005
  • Posts: 100
  • Status: Offline

Post February 5th, 2008, 12:54 pm

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
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 5th, 2008, 12:54 pm

  • kc0tma
  • o|||||||o
  • Web Master
  • User avatar
  • Joined: Jul 20, 2007
  • Posts: 3318
  • Loc: Trout Creek, MT
  • Status: Offline

Post February 5th, 2008, 1:32 pm

Are you absolutely positive the php script has the exact path 100% correct, no typos or anything?
Like Mr Spork, I also write about my interest in alcoholic beverages.
  • steven420
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 16, 2005
  • Posts: 100
  • Status: Offline

Post February 5th, 2008, 1:55 pm

I just double checked and it is perfect. Tried cat -n "path to file file" and it read the file. (I placed a copy of the file in there to see if I could read it from the script.)
  • steven420
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 16, 2005
  • Posts: 100
  • Status: Offline

Post February 5th, 2008, 2:14 pm

Ok I think I 've found what is causing the problem. "open_basedir restriction in effect". How do I fix this?
  • kc0tma
  • o|||||||o
  • Web Master
  • User avatar
  • Joined: Jul 20, 2007
  • Posts: 3318
  • Loc: Trout Creek, MT
  • Status: Offline

Post February 5th, 2008, 2:26 pm

Beats me! My guess would be to find that in your httpd.conf file or whatever it is called and stick a # in front of that line, then restart the httpd service.
Like Mr Spork, I also write about my interest in alcoholic beverages.
  • steven420
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 16, 2005
  • Posts: 100
  • Status: Offline

Post February 5th, 2008, 2:48 pm

I just submitted a support ticket so we'll see if my hosting company can fix this for me. Thanks for the help.
  • this213
  • Guru
  • Guru
  • User avatar
  • Joined: Mar 01, 2004
  • Posts: 1242
  • Loc: ./
  • Status: Offline

Post February 5th, 2008, 5:23 pm

They probably won't if you're on a shared host. The option (defined in /etc/php.ini) is there for security reasons.

Without getting too technical, it stops scripts from one account from interfering with another account\ on the same server.
  • steven420
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 16, 2005
  • Posts: 100
  • Status: Offline

Post February 5th, 2008, 6:10 pm

I have a dedicated server. They're looking into it.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 80 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.