Tuesday, April 27, 2010

A common problem of including external files to your PHP script

Hi coders, I want to share a common phenomena with you about including an external file to your script. It could happen that there is an external file in your server which is named a.php (for example) and you have included it in another file called b.php. You also have permissions. But the file is not including to your mother script.

This is sometimes a common problem for many of you. The reason behind this is, there is a term called "allow_url_fopen" in php.ini. If your server configuration unintentionally (or i should say intentionally) turn off this property, then this will lead the problem.

But you can thankfully turn on this property with the help of the ini_set() function in php. The syntax to turn on the "allow_url_fopen" is: ini_set("allow_url_fopen", "On"); In this way, you can set the value for this property and this will solve your problem of including the file in your script.