There are a lot of ways for detecting if you are running PHP code on localhost or server. However they use $\_SERVER and http header which can be fake by user.

It is serious for me because I have made a developer php **shell interactive** on my website which should go to 404 if it is not on the localhost.