From here- realpath()
returns FALSE on failure, e.g. if the file does not exist.
So it seems in your localhost, you may not have the file structure as you said.
From the same source : The running script must have executable permissions on all directories in the hierarchy, otherwise realpath()
will return FALSE.
So, also make sure that there is no permission issue.
EDIT:
From here:
The function realpath() will not work for a file which is inside a Phar as such path would be a virual path, not a real one.
That is realpath(..)
won't work for any virtual directory, it will work only if the path is real i.e. not virtual.