I am using <?php include ('/php/header.php'); ?> in my php index file. Everything shows up in Dreamweaver, but as soon as it hits the web server and I go to access it absolutely nothing shows up. All I get is a blank page with no source code. HELP!

Recommended Answers

All 7 Replies

You pobably have a sintax (writing) error in your 'header.php' file; check that you have closed all the brackets and parenthesis and also that you have sthe ';" at the end of every line of code etc.
Yu also might have a wrong path to the file: '/php/header.php' means the php folder under your root directory; my guess is that you have an error in your header.php file, but on your local system the path to your file is wrong and php passes over the file (try to use require instead of include and see if you get an error) while on your server, the path is ok, causing the main script to really load the header.php (with the error in it) which gives you tha blank page... or the vice-versa: the local path is ok but the remote path is wrong; check that everything is right both local and remote.
Than, of course, I may be wrong :)

Now I am getting this error

Fatal error: main() [function.require]: Failed opening required '/php/header.php' (include_path='.:/usr/local/lib/php') in /homepages/22/d205045794/htdocs/temple_games/index2.php on line 4

That's exactly what I said: the path to the file is wrong.
Try to use a relative path, instead of an absolute path and make sure it is correct.

That's exactly what I said: the path to the file is wrong.
Try to use a relative path, instead of an absolute path and make sure it is correct.

Path to the header file or to the php folder?

to the header file;
if you don't know exactly what the path is, wright here the path to both your 'header.php' file and the main file (the one that tries to include the header), starting from the root of your server; for instance, if your header.php is in 'www.yourdomain.com/php/header.php' the absolute path (starting from the root of your server) is '/php/header.php'

to the header file;
if you don't know exactly what the path is, wright here the path to both your 'header.php' file and the main file (the one that tries to include the header), starting from the root of your server; for instance, if your header.php is in 'www.yourdomain.com/php/header.php' the absolute path (starting from the root of your server) is '/php/header.php'

Some times it's the little things that always stump me. Glad to have people like you around. Thanks!!

I'm glad to be of help!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.