PHP require/include only works once in script then fails

Posted by Colin on Stack Overflow See other posts from Stack Overflow or by Colin
Published on 2010-05-12T15:43:53Z Indexed on 2010/05/12 16:04 UTC
Read the original article Hit count: 196

Filed under:
|
|

Hi everybody, this isn't a problem as such but it's bugging me and I would appreciate any help. It might be totally obvious but I can't see it.

$root_path = $_SERVER['DOCUMENT_ROOT']

require($root_path .'template/header.php')

require($root_path .'template/footer.php')

The script will include one or the other but not both. It will run and include the header but not the footer, if I swap them round it will load the footer first but not the header.

I've tried using include instead of require but get the same result.

It gives the error allow_url_include = 0. I know turning this on will solve it but my question is why is it happening? Why will it include one file but not the other? Is there any way to get them to both run without turning allow_url_include on (I'm trying to be security conscious). I have PHP 5.3 and am running WAMP. Thanks in advance for your help!

© Stack Overflow or respective owner

Related posts about php

Related posts about require