Why can I use a scriptname as a valid path

I’ve a url like this:
https://mydomain/script.php/anotherscript.php

If both scripts exists in my root dir (mydomain) there’s no error an the script “anotherscript.php” was shown. Because of relative pathnames the side is not shown correctly.
How can I impede this call? It’s difficult to describe this case, so I didn’t find anything helpful.
Thank you in advance.