Posted by Nessa | Posted in Uncategorized | Posted on 28-04-2007
I found this out after troubleshooting a few sites a couple weeks ago. Unlike all other previous versions of PHP, with 5.2.1 you can no longer use a URL to include files, even if you have allow_url_fopen enabled in your php.ini.
Just a quickie about what an ‘include’ is, it’s a php function that lets you include the contents of a file into another. It usually takes the form of this:
This is a local include, and is usually the preferred method. A remote include is that of a URL:
Most people would agree that remote includes are a major security issue for novice coders who don’t have any kind of file validation in place to protect their scripts, but if you’re convinced that your code is down, you can add this line to your php.ini file to allow remote file includes:
Now, this directive did not exist until php 5.2.1 was released so Cpt. Obvious says that:
1) you cannot use it with versions prior to 5.2.1
2) You’ll need to add it to your php.ini, as you probably won’t find it in there already
3) allow_url_fopen has to be enabled
4) This has to be in the php.ini server-side, and not the .htaccess
If you’d like to know more about remote file inclusions (the bad kind), read my article.