PHP Include

User 47216 Photo


Registered User
210 posts

I utilize a PHP include for most of the sites I do (mainly for the menu)

Today a person who i do a website for told me their menu was not appearing.... www.stickywicketgrill.com

I checked and he was right but I cannot figure out why since no coding was changed. He did tell me that he received an email that his domain was expiring so he called network solutions to renew it. The site is hosted on my VPS server that i lease and all other sites are working fine when it comes to the PHP coding I have in place.

I checked the whois and the nameservers are set properly (obviously they are because the site is still coming up) just the coding for the PHP include is not working.

Any idea what would cause this
User 1948478 Photo


Senior Advisor
1,850 posts

You have a number of validation errors that could cause hick-ups, e.g.:

- Missing doctype declaration.
- An extra <body> tag (located after the location of your missing menu).
- You are using the <frameset> tag without a doctype that explicitly allows for this. The frameset is located just after your missing menu.
- The <title> tag is located outside the <head> section.
- No character encoding specification.
- Some closing tags are missing.
- ...and more...

Even if "no coding was changed", as you say, I'd venture a guess that something like a recent update to server software (Apache, PHP, etc) in conjunction with some of the more serious validation errors might cause the PHP includes to be skipped.
I'd clean up the code as per the reported validation errors if I were you.

I'm not sure I quite understand how your hosting is setup with your "own server" and "leasing", etc., but I would call and ask whoever is responsible for, or knowledgeable about, the host/server. ;)
User 47216 Photo


Registered User
210 posts

Unfortunately i took this website over for the owner (who originally created it) and did not really do anything with the coding because he wants the full thing re-done by me (thank god) so i am going to start from scratch once he gets a design idea ready.

I ran the main page through the CC code cleaner and re-named it to http://www.stickywicketgrill.com/test.php

I see where the frameset tag is appearing (where the php code is) but I am not using that frameset code anywhere so i have no idea why it started appearing.

I also see the extra body tag you are reffering to (actually it is a closing body tag) and i cannot understand why that is appearing there either.

The code I have on the website where all of the frameset is appearing is...
<!-- Start Button Navigation Include -->
<?php include("http://www.stickywicketgrill.com/button_menu.php"); ?>
<!-- END Button Navigation Include -->


User 2733 Photo


Ambassador
426 posts

If that code stopped working recently, it would be because the host has turned off allow_url_include in the php.ini file. Use an absolute path and you'll be fine.

<!-- Start Button Navigation Include -->
<?php include("/path/to/your/file/button_menu.php"); ?>
<!-- END Button Navigation Include -->
Let's not get all hurt.
User 47216 Photo


Registered User
210 posts

David...

The same coding is working on all sites on my server .... it is just this one that is giving me the problem. I did try including a menu file from another site into this one and it seems to work so I am guessing there is some error int he include file code that is not allowing it to show
User 47216 Photo


Registered User
210 posts

OK I think I figured out what is wrong here...... once I changed the php include code from
http://www.stickywicketgrill.com/button_menu.php

to

button_menu.php

It worked. Obviously this does not help me with the pages I have int eh subfolders of the site. The weird thing is..... the same code works perfectly fine on other websites on my server so i am still confused
User 47216 Photo


Registered User
210 posts

And actually just changed all of the pages in subfolders to this include
<?php include('../button_menu.php'); ?>

and they now work. The weird thing is all other domains on the same server work perfectly fine using a full url address....only this domain was affected. I emailed tech support for my server and they informed me there have been no recent changes that would contribute to this.
I'm baffled
User 47216 Photo


Registered User
210 posts

Also I setup a php info file at http://www.stickywicketgrill.com/php.php and it appears all of the settings are correct to allow for a url open in php scripting
Unless I am missing something
User 2733 Photo


Ambassador
426 posts

I looked at your test.php page and noticed nearly two dozens images with src attribs using an http path. You realize that creates extra load on the server, right?

Chances are your host's httpd conf file allows for 20 requests at a time per IP before another server process is spawned. That means if you changed those img src references to relative paths...

from this...
<IMG SRC="http://www.stickywicketgrill.com/graphics/buttons/faqs.gif" alt="Frequently Asked Questions" BORDER=0" width="161" height="35">

to this...
<IMG SRC="graphics/buttons/faqs.gif" alt="Frequently Asked Questions" BORDER=0" width="161" height="35">

...it would grab the page and most all of its contents in a single connection (instead of 20+ connections) and speed up the page (any page) significantly.
Let's not get all hurt.

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.