Solved

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

Posted on 2006-06-21
8
878 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

911 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

20 Experts available now in Live!

Get 1:1 Help Now