0

What, if anything, is wrong with this code? I'm a beginner. I'm trying to include a header file but when I test and try to load it says it's not working.

<?php include("http://test.orwallo.com/widget_corp/includes/header.php"); ?>
6
  • 1
    I'm pretty sure PHP doesn't say it's not working. What's the real error message? Commented Jan 16, 2011 at 12:07
  • 1
    www.test.orwallo.com/widget_corp/staff.php will give you the error message Commented Jan 16, 2011 at 12:09
  • <?php require_once("test.orwallo.com/widget_corp/includes/functions.php"); ?> <?php include("test.orwallo.com/widget_corp/includes/header.php"); ?> Commented Jan 16, 2011 at 12:10
  • 1
    @Michael , we recieve internal server error 500; Probably you have the actual error? Commented Jan 16, 2011 at 12:13
  • That gives a HTTP/1.1 500 Internal Server Error. You'll have to look into your error.log to find out the reason. Commented Jan 16, 2011 at 12:15

2 Answers 2

4

I can't tell for your HTTP 500 error. But you are clearly using include() wrong.

The include or require_once statement is used to load local php files. You should not have a reason to include URLs. Rewrite it to:

<?php
   require_once("./includes/functions.php");
   include("./includes/header.php");
?>

Adapt the path.

Sign up to request clarification or add additional context in comments.

1 Comment

Including php files via http(s) is considerd a security risk. (and is blocked by default)
0

i tried to open this file but it appears that it's not exist

2 Comments

This is the whole file that I'm trying to load but i'm getting a server error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.