suppose I've two services using the same domain but different hostnames as well as on different physical computer systems (for instance maps.google.com and mail.google.com). I wish to include some php code in one server towards the other... how do i do that? (I see several things concerning how to include across different domain names on a single server but this is not things i want.)

EDIT: I control each of the help that I wish to include between but they're on different physical servers underneath the same domain. It's been recommended which i make use of a repository after which have each server clone that, so my real question is now am i going to have the ability to instantly have every server update to the newest version when changes are created to that repository? I'm attempting to make a code base of fundamental functions over the different services.

If you wish to incorporate a php file from the remote HTTP server, you'll face two issues:

  • the remote server will interpret its php file, so you will simply obtain a HTML (or other produced format) stream. It may be side stepped, but you need to access the remote server configurations.
  • it's definitely not safe. If a person changes the remote script, he is able to do very bad things (like getting rid of files, as well as performing system instructions)

However, when the remote server allow you to access the script in the plain text version, you can easily include it.

You cannot, a minimum of not without subjecting your code towards the public. Whether it were easy to read PHP source from the server, that might be a dreadful security hole.

In case your code certainly is not sensitive, change its extension to ensure that it's non-executable (say, a .inc file) and can include that rather.

I would recommend mounting the remote host's directory (good examples: NFS (Network File System) for Linux, Home windows shares for Home windows).

Including (= performing) code over HTTP is not advisable since there is no authentication involved.