Be careful when using is_readable on symbolic links.
is_readable will return true if the file the symbolic link is pointing to is readable.
The problem is that if the server does NOT allow to follow symbolic links, is_readable will still return true, but e.g. redirecting to the sybolic link will not work. For Apache, make sure that at the server, virtual host configuration level, or inside a directory container you have set
Options +FollowSymLinks
As an example, let's say you have at the document root directory:
index.php -- the script using is_readable
my_linked_page.html -- a regular HTML page
my_link -- a link pointing to my_linked_page.html
Now in index.php:
<?php
if (is_readable('my_link')) {
header('Location: /my_link');
}
?>
If FollowSymLinks is forbidden, this will not work, if allowed, it will.