Solved

GoDaddy Hosting: PHP Include Statements Don't Seem To Work

Posted on 2006-06-21
8
881 Views
Last Modified: 2008-01-09
I have a godaddy account in which I am hosting my website.  I've come to learn that a certain php file can be created and uploaded to my site that will allow me to place a google ad on multiple pages and change it by only changing the php file.  Each page that has the ad will have the statement <?php include("linktophpfile/ads.php");?>  I've tried this multiple times with no success.  I was wondering if it is an issue with the coding or if it is something I need to take up with godaddy.  It seems to me that php is not enabled on godaddy or something of that sort.  I've gone to the ads.php link and the code in there works it is just the include statement that does not seem to be getting through to the php file.

Thanks for your help
Steve
0
Comment
Question by:SteveZz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 50 total points
ID: 16950724
> it is just the include statement that does not seem to be getting through
Are your files saved with the ".php" file extension?
There is a good chance the web server only processes php on files that have the ".php" extension.
0
 
LVL 3

Author Comment

by:SteveZz
ID: 16950864
The file I am including is a php file, the file I am calling it from is html. My index.html file is the file that I placed <?php include("linktophpfile/ads.php");?> in.  Is that the problem?  Should I make my index.html file into an index.php file?
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 16950998
Yes, that's probably the problem.  Rename it to "index.php".
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:SteveZz
ID: 16951057
Alright well I can't test that idea out just yet bc i'm stuck in work and apparently cant edit anything lol.  But thanks for the idea I'll check it out tonight and give you the points if it works.  Thanks
0
 
LVL 3

Author Comment

by:SteveZz
ID: 16954766
I've spent time thinking about what you said with renaming the other files to php files and that's not going to work for me.  I need each page of my site that is already made to be able to call an include statement for a php file.  I need each of those .html files to be able to run a php file on the site.  The reason I need this done is for google ads.  I can place a google ad code on a php file and then from each page of my website I can link to that same file and instead of having the change every html file to change the color of the ads I can change the php file and all of them change.  I think I must just have the code wrong so I guess what I'm asking is what I would have to put onto my html file to include a php files information onto the html file.
Thanks so much if you can help me out
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 16957685
For php to also process ".html" files, you would need to change the configuration of the web server.  And that's impossible if you are using colocated hosting.

Another possible solution is to use url-rewriting (mod_rewrite if you are using Apache) to redirect your requests to a php file that includes the ads and the html file that has been requested.

Apache also has SSI (server-side-includes), but you usually need to use the ".If you a" file extension to be able to use it...  So, that's the same problem.
http://httpd.apache.org/docs/1.3/howto/ssi.html
0
 
LVL 3

Author Comment

by:SteveZz
ID: 16960323
Thanks so much for all of your help.  I've decided to take the easy route and build my websites using .php files rather than .html files.  I don't see any reason not to.  Once I changed them it worked fine.  I appreciate all of your help.
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 16960522
<:°)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to combine and minify CSS and JS files 5 38
I'm a Human captcha checkbox 13 39
Link not working 6 42
Adding 1 the value of input "text" every 3 seconds 5 33
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question