files not being seen

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oceanic
Forum Newbie
Posts: 2
Joined: Fri Feb 24, 2006 4:30 pm

files not being seen

Post by oceanic »

If I do these steps:

- use file_exists to look for an image (it does not exist)
- the php code creates the image (/web/images/123.jpg)
- execute clearstatcache
- execute getimagesize to get the image dimensions
It says the file is not there - get an error. Yet the file is there when I look at the file system.

If I do these steps:

- use file_exists to look for an image (it does not exist)
- the php code creates the image (/web/images/123.jpg)
- clearstatcache
- execute `/bin/ls -lsa /web/images/123.jpg` (returns nothing)
- execute getimagesize to get the image dimensions
It says the file is not there - get an error.

If I do these steps:

- use file_exists to look for an image (it does not exist)
- the php code creates the image (/web/images/123.jpg)
- clearstatcache
- execute `/bin/ls -lsa /web/images` (returns entire directory, and the new image is listed)
- execute getimagesize to get the image dimensions
The file is there and the code can access it.

If I don't do 'clearstatcache' in the last set of steps, it still works.

So it seems that by doing an 'ls' on the entire directory, something in the OS gets updated and php can then see all the files.

The /web/images is a mount from the web server to another server, which creates the image.

Does anyone have any ideas on why this is happening?

We are using:
Linux – Fedora Core 4
Apache – 1.3.34
PHP – 4.4.2
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Have you tried to chmod the directory?
oceanic
Forum Newbie
Posts: 2
Joined: Fri Feb 24, 2006 4:30 pm

Post by oceanic »

The directory is 777. I verified that the image is always created, it's just a matter of the php seeing it or not based on the steps I listed.
Post Reply