Frequently Asked Questions

Include error?

Help! I’m trying to include a file with the following code: “include(”http://mydomain.com/file.php”);” but gives me an error. What’s wrong?

Instead of putting the full URL, put either a relative URL:

include "file.php";

or the absolute path:

include "/home/whatever/public_html/file.php";

The newest version of PHP doesn’t allow full URLs in includes. So stick to relative paths and absolute (server) paths and you should be ok.

One little tip: if you absolutely need to include a URL from a diferent server, put an @ in front of the include. That will hide the error message from the browser, however it doesn’t guarantee that your includes will work!