Text file being writen to the wrong directory.

  • steven420
  • Graduate
  • Graduate
  • steven420
  • Posts: 100

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • kc0tma
  • o|||||||o
  • Web Master
  • User avatar
  • Posts: 3318
  • Loc: Trout Creek, MT

Post 3+ Months Ago

Are you absolutely positive the php script has the exact path 100% correct, no typos or anything?
  • steven420
  • Graduate
  • Graduate
  • steven420
  • Posts: 100

Post 3+ Months Ago

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
  • steven420
  • Posts: 100

Post 3+ Months Ago

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
  • Posts: 3318
  • Loc: Trout Creek, MT

Post 3+ Months Ago

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.
  • steven420
  • Graduate
  • Graduate
  • steven420
  • Posts: 100

Post 3+ Months Ago

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
  • Posts: 1260
  • Loc: ./

Post 3+ Months Ago

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
  • steven420
  • Posts: 100

Post 3+ Months Ago

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 70 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.