Solved

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

Posted on 2006-06-21
8
877 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
  • 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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article discusses four methods for overlaying images in a container on a web page
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…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now