tags:

views:

37

answers:

1

I have an interesting situation where I have a perl watcher script (using Linux::Inotify2) watch for files to be dropped in a certain directory, then hand them off to a PHP script for processing. The watched directory and the files in it are not owned by the user the watcher script is running under, but the entire directory tree the files are being dumped in are rwxr-xr-x and the file is world readable.

Here's my delemma. The PHP script cannot open a file handle on the file passed to it when called from the perl script using system(), exec() or ``. However, the PHP script can open a file handle on the same file when the script is run manually from the command-line using the same effective user.

Anyone have any ideas why this would be the case?

A: 

Your fopen() calls probably rely on relative paths that break when the working directory change.

Álvaro G. Vicario
I'm passing the file name, and the absolute path is pre-pended within the PHP file. The PHP file can accurately determine that the passed file *exists* but can't open a file-handle on it.
Preston