I am using PHP on a 32 bit Linux for walking through a mounted remote filesystem (CIFS) and I have noticed that Unix's stat-related functions do not work (stat()
, filemtime()
, is_dir()
, and so on).
This is starting point:
$ sudo mkdir /mnt/cifs-mount-point
$ sudo mount -t cifs -o user="user",password="password" //example.local/share /mnt/cifs-mount-point
And these are some tests:
<?php
stat('/mnt/cifs-mount-point/directory'); // This will rise a Warning and return false
is_dir('/mnt/cifs-mount-point/directory'); // Will return false
I have checked the same in Bash and it works as expected:
$ stat /mnt/cifs-mount-point
$ if [ -d /mnt/cifs-mount-point ] ; then echo "is dir"; fi
stat()
may not work on mounted CIFS' in 32 bit systems if you do not specify the option noserverino
when mounting. E.g:
mount -t cifs -o user="user",password="password",noserverino //example.local/share /mnt/cifs-mount-point
Other functions based on stat()
data such as file time functions and is_dir()
are affected the same way.
This happens because if you do not specify the option noserverino
the remote inode may be 64 bit-based and thus the local system cannot handle it.