files not being seen
Posted: Fri Feb 24, 2006 4:31 pm
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
- 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