I would like to know how to configure apache (with .htaccess or any other way) so that a php script/file which might contain some sort of back door, function, call to unidentified servers be denied calling or receiving data from remote servers.
I am on a Linux Shared hosting with SSH access.
Apache has nothing to do with this. Apache is just the web server which accepts an incoming HTTP request and hands it off to a PHP script. This PHP script runs with the full privileges of whatever user it’s running as, it is not under the thumb of Apache in any way.
Either lock down the PHP configuration to disable any extensions or settings that allow it to communicate with anything outside or lock the system down with firewall rules or entries in the
hostsfile that prevent the entire system from contacting some specific outside address.On a shared host you probably can’t do any of this.