Page 1 of 1
file_exists returning false but I know the file exists
Posted: Mon Jan 29, 2007 11:41 pm
by Luke
For some reason this is returning false:
Code: Select all
if (file_exists('/home/luke/sites/library/Zend/library/Zend/View.php'))
{
// Do something
}
I know that file exists because I just opened it. I type location in as /home/luke/sites/library/Zend/library/Zend and I see View.php in the directory! What could be causing this?
Posted: Mon Jan 29, 2007 11:53 pm
by Luke
OK, it seems to be a permissions issue...
I still am not a real permissions hero. How would I give php read access to the library directory and everything under it?
forgive my n00bishness... in phpinfo() the only thing I get about users/groups is this:
User/Group www-data(33)/33
so... would I chmod the library to give read access to www-data(33)?? I really need to read up on this stuff.
Posted: Mon Jan 29, 2007 11:59 pm
by feyd
PHP will likely fall into the "other" category. Read will obviously be needed, execute may be needed on some systems.
Posted: Tue Jan 30, 2007 12:05 am
by Luke
I'm sorry... what do you mean by this?
PHP will likely fall into the "other" category

EDIT - nvm - thanks google!
See this is just another reason I'm glad I switched over to linux. I've never had to worry about this stuff before... I need to actually sit down and REALLY read up on *nix and file permissions and I plan to, but you guys know as well as I do that it's easier said than done. I'm so damn busy right now it's hard to fit ANYTHING extra in. I think it's really important that I know this stuff though, so it's going to the top of my priority list.
Posted: Tue Jan 30, 2007 12:36 am
by Kieran Huggins
permissions are the binary representation of read/write/execute for user/group/world, so if the file is owned by the same user as is running php , then r--xxxxxx (4xx) should be fine.
It's likely not owned by the same user, nor will they be in the same group. In such a case you'll need to grand read access to the "world". (xx4)
A very common file permission in linux is rw-r--r-- (644) which gives the user read/write access, and everyone else read-only access.
You use chmod to set the permissions, and chown to reset ownership. a quick `man chmod | less` will give you a handy reference

Posted: Tue Jan 30, 2007 5:01 am
by Jenk
You could also give it sticky privileges, but I'll let you read up via Google before we go into that :p