JestaBlunt JestaBlunt - 12 days ago 6
PHP Question

LAMP's is_file returns false for files in symlinked directory

My problem is: I have a huge data directory (400GB) from a website and have a second website enabled for the new design, where I have symlinked the data directory.

Now there are some file checks using

is_file()
, but they return
false
and if remove the file check, it renders the background-image for example, I can also access all the files in the browser via file listing using the non-original URL.

I've searched trough google, found some things about permissions, users, and groups. so I tried to get the user and group of the PHP-process using

$processUser = posix_getpwuid(posix_geteuid());


the whole thing is running on an ispconfig3 server and both sites are on the same server.

The user and group of the original, hard directory are web1:client1.
the user and group of the web directory with the symlink are web14:client1.

The running process is from user web14, which has its permissions set to 775 for the parent directory, where the symlink remains, and the original directory.

As I understand both users are in the same group and group has RWX or what could be the problem?

Answer

So, I solved the problem. My fault was that I was searching for errors from bottom layer to the top, cause I thought it was a permissions problem.

After many try and fails I found the not very obvious "option" panel in ISPConfig, where you could set some openbase-dir values for the clients webspace, which was chaining php to the directory. Now I just added the "main" webspace holding the 500GB data directory to the "child" webspace with the symlinked directory and its working like a charm.

Warning: my PHP was writing out with umask(022), so the group was only able to read, if you write out on the child "webspace" you have to set the umask to (002), so group is allowed to write to.