Page 1 of 1

stat(), is_dir, is_file, etc... not working

Posted: Mon Sep 30, 2002 11:02 pm
by StillGreen
I recently installed apache2, mySQL, and php4 on win98 (before I had MDAC installed) (newbie) and have the following problem...

functions like is_dir(), always return 0 whether it's a directory or not. The stat() functions return an error or no data. It seems as if these functions are finding no file or directory data, even though functions like fopen() will work. Is this a php problem? windows? apache? anyone have any ideas?

Apache 2.0.43 / MySQL 3.23.52 / PHP 4.2.3 on RedHead Linux 7

Posted: Wed Oct 23, 2002 2:40 pm
by Jan
I have exactly the same problem that you describe - except on Linux.

I had discovered this problem after uptating my LAMP-Architecture on my phpBB2-BulletinBord.
It comes into troble with file_exists() which does not work anymory.
After some nightly hours it looks like that the problem lies between Apache 2.0 and the new (?) API for PHP.

Jan.

Posted: Thu Oct 24, 2002 5:19 am
by Takuma
From the PHP Manual:-
[Editor's note: you need to pass either the correct relative or absolute path to the function]

is_dir() does not work correctly (i.e. returns false on some folders) unless you chdir() to folder that contains the file/folder you are checking.
[on Linux Red Hat 7.2]
and
Just as a quick addition to another comment, you must also chdir() on Windows machines.