Fix $PHP_SELF so it works in subdirectories (the use basename() produced...

... invalid links when viewing pages in the ext/ directory)