Php require not working

I am getting a fatal php error when I view my page. I am using <?php require(‘my page’); ?> where my page is the file I want to include. This code works perfectly on my local PC, which is running PHP 5.2.8. Any ideas why this doesn’t work here?:confused:

try


<?php require 'my page.php'; ?>

require can be irritating, if you can, you’re better off to use


include 'my page.php';

Do you want to rename your file from ‘my page’ to ‘my_page.php’.
I don’t think you can call require or include with a file that has a filename including a space, and no file extension.

then call the script by
<?php
require(“my_page.php”);
?>

Also, make sure it is in the same directory as the script calling the file. Otherwise you have to link to it absolutly.

Cheers,

The file called in the include is header.html. I am using <?php include(‘header.html’); > and getting the fatal error. It is in the same directory as my php page calling it, and I tried the suggestion above about removing the (). This didn’t work. It’s almost like this host doesn’t allow for the include() or require() methods. Any ideas?

your script might not in the right folder your file that you want to include so you might want to put in your full path to your file and see if that might work better.

This is the error.

Warning: include() [function.include]: Failed opening ‘header.html’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/a9437609/public_html/Default.php on line 10

This is the code

<?php include(‘header.html’); ?>

header.html is in the same directory as the file calling it with the include(). Does this help?

I have exactly the same code and it is working just fine

http://ongetc.blogdns.net/

Try to rename Default.php to default.php and remove all but just one line to see what happen.

Thanks chanh. your suggestion wasn’t the solution, but it did give me the clue to the solution. I wasn’t thinking about this server being unix, and therefore case sensitive. I had header.html uploaded as Header.html. Once I changed the code to look for Header.html, it’s working great now.