Need insight to PHP includes? - Post...

User 243515 Photo


Registered User
508 posts

I finally figured out how to use PHP include() and have been busily changing my websites with success until I tried to ceate a Footer include that has javascript code in it that displays the Last Update date:

document.write("Last update: " + document.lastModified + " PST");

I fist created a PHP include file then inserted the PHP line in my web page: <?php include ("Includes/footer.php"); ?>
When the page runs I get the following errors:

Warning: include() [function.include]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead in /home/tacoma6/public_html/index.php on line 50

Warning: include() [function.include]: Failed opening 'Includes/footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tacoma6/public_html/index.php on line 50

I've tried to search for a way to use the correct php/javascript combination but have no idea of what to search for. I would appreciate any assistance. The web site in question:http://www.tacomagames.org

Thank you;
Greg
User 38401 Photo


Senior Advisor
10,951 posts

rhubarb67 wrote:

Warning: include() [function.include]: Failed opening 'Includes/footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php')


I could be wrong here but that include path looks to me like it's a local path on your own computer rather than a location for your web page. The include path needs to be the location that the file(s) will be when uploaded to your web server rather than the location it is sitting on your computer. Not sure if that's the issue, but looks like it may be to me. :)
User 187934 Photo


Senior Advisor
20,196 posts

Looks like you forgot to upload the files your including.
http://www.tacomagames.org/Includes/
Your index page has several extra tags. This is usually from having them on the page your including with php. You don't need all that on the pages your including.
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>


You should alter your .htaccess to prevent directory browsing.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 243515 Photo


Registered User
508 posts

Thank you both! As soon as I read Jo Ann's message I knew what I had done. I got so excited that I had forgotten to check the Includes file. That's it, no more late night coding for me!

I had browsed a php related website and read that the <DOCTYPE> was required, thanks for the correction Eric, I was wondering how I was getting multiple tags.

I've updated the include files and made the adjustments you told me about; everything looks fine now, Thank you both!

Greg
User 38401 Photo


Senior Advisor
10,951 posts

You're quite welcome Greg, enjoy your new toy :P

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.