Page 1 of 1

PHP includes fail, but inconsistently

Posted: Tue Apr 24, 2007 4:29 am
by slade27
I have an index.html page that uses two php includes (I've made the appropriate addition to my .htaccess file to allow this to happen).

So far, so good. The index.html page loads fine along with the appropriate data from the includes -- for the first few times, at least. But if I refresh the index.html page several times on any given browser, one or both of the includes eventually returns an error message as follows:

Code: Select all

main(http://www.somedomain.com/articles/last10blurbs.php) [function.main]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden  in /home/somedirectory/public_html/index.html
Then, if I refresh the index.html page AGAIN, the includes both load correctly. And so on as I repeatedly refresh the page: Sometimes the includes load correctly, sometimes one or both of them load incorrectly.

I'm a newbie; however, this seems to me to be a permissions problem -- however, the permissions for index.html are set to 6-4-4, which I thought was correct.

My question is: Why do the includes sometimes fail and sometimes work, and how can I correct the problem?


Thanks.

Brian

Posted: Tue Apr 24, 2007 5:59 am
by Mohit_Prog
include never fails.
In which way [s]u[/s] you have included? can [s]u plz[/s] you please write those statements here.

Posted: Tue Apr 24, 2007 6:01 am
by mentor
You should include in this way

Code: Select all

include "articles/last10blurbs.php";
not like

Code: Select all

include "http://www.somedomain.com/articles/last10blurbs.php";

Posted: Tue Apr 24, 2007 10:44 am
by slade27
Sounds like you've diagnosed the problem.

Here's the sort of include statement I've been using:

Code: Select all

include 'http://www.somedomain.com/articles/showall.php';

Now I'll try:

Code: Select all

include "articles/showall.php";
Thanks.

Brian