Click here to get back home

PHP include suddenly not working?

 HomeNewsGroups | Search | About
 alt.www.webmaster    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
PHP include suddenly not working? Heidi 10-01-2007
Get Chitika Premium
Posted by Heidi on October 1, 2007, 1:42 am
Please log in for more thread options
the server my sites are hosted on had a hard drive failure.
They put everything back to normal... sort of...

I have the index.php file with this code:

<?php
include ("nav.html");
?>

And other pages in other directories with this code:

<?php
include ("http://example.com/nav.html ");
?>

Yet that second one doesn't work suddenly. It used to work just fine before.
Now when these pages load with the include using the full url path the page
stops loading and I get all these bizarre core.##### where # is a random
number in my directories.

Tech support said this:

Regarding the core files:

These core files are called core dumps and were created when a php script
crashes or is unable to run. You can delete these core files. Please check
after some time and if you still see the core files, then you should have
your script checked for any errors that might be causing it to crash.

---------------

So why if that include ran fine before does it not run fine now? They also
changed it so that it wasn't an include anymore but rather had the full
navigation on the page which worked but isn't what I want. I wanted the
includes so I would not have to update every page when I changed the
navigation or added to it which will be fairly often.

Any help/thoughts appreciated.

Heidi




Posted by Heidi on October 1, 2007, 1:51 am
Please log in for more thread options
Heidi wrote:
: the server my sites are hosted on had a hard drive failure.
: They put everything back to normal... sort of...

Okay nevermind I found the fix. What I don't get is why the full url didn't
work suddenly when it used to before the crash Sunday.

So now I am using ../nav.html instead of the full path to the nav.html file.

heidi



Posted by Mark Goodge on October 1, 2007, 2:53 am
Please log in for more thread options
On Mon, 1 Oct 2007 00:51:51 -0500, Heidi put finger to keyboard and
typed:

>Heidi wrote:
>: the server my sites are hosted on had a hard drive failure.
>: They put everything back to normal... sort of...
>
>Okay nevermind I found the fix. What I don't get is why the full url didn't
>work suddenly when it used to before the crash Sunday.
>
>So now I am using ../nav.html instead of the full path to the nav.html file.

They may have disabled URL includes. It's a security risk anyway, as
well as being an unnecessary overhead on the server. It's far better
to to use file paths, either relative or absolute, than URL paths.

If you don't know the full absolute file path (which you may well not,
on a shared host), then you can get the server to fill that in for you
by using this type of construction:

<?php
include($_SERVER['DOCUMENT_ROOT'] . "/myfile.html");
?>

which is equivalent to a URL include of

<?php
include ("http://example.com/myfile.html");
?>

and will work from any page on the site, even in a subdirectory.

Mark
--
http://www.MotorwayServices.info - read and share comments and opinons
"I don't care if it hurts, I want to have control"

Similar ThreadsPosted
Re: SSI and HTML or PHP and include? January 25, 2006, 4:16 pm
php include pages as a menu? October 24, 2005, 2:42 am
Include file mystery March 8, 2006, 11:17 am
best way to include xml into html page??? October 26, 2006, 3:11 pm
Server side or PHP include? March 15, 2007, 6:04 pm
Which Web 2.0 bling to include on pages? July 10, 2007, 5:37 am
Loading a different include file every 5 seconds February 8, 2007, 7:25 am
PHP Include script fails during traffic spikes February 26, 2006, 10:01 am
Is there any way to include a .com domain hosted in usa in (pages from UK) search results August 30, 2006, 4:14 am
What is the best way to include css styles in Rich Text E-mail? And yes, i already tried Googling this. November 5, 2006, 2:01 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap