Page 1 of 1
PHP mysterious problem
Posted: Mon Mar 03, 2008 6:08 pm
by fearlesss
Hi,
Sorry my first post is a question , rather than an answer but I don't really know
much about php ill be honest.
Ok I have 2 websites running the exact same pages but on different servers
one works one doesn't
http://www.biddingbuzz.com.au/index.html
This is the page and at the bottom is a php script
<?php
include("footer.html");
?>
The other page is the same html file with the same script
http://www.youwonthebid.com/index.html
Now I've been told you cant run php in a html file without changing the extention to .php
but for some reason on the bidding buzz site the php works ?
I cannot figure out how on earth how it works im sure its something to do with the hosting
bidding buzz host runs PHP Version 4.4.4
youwonthe bid host runs PHP Version 4.3.11
Can anyone explain whats going on here
Re: PHP mysterious problem
Posted: Mon Mar 03, 2008 6:36 pm
by Christopher
I would guess that the first server has PHP parsing .html files and the second does not. Change the name of the script on the second server that does not work to:
http://www.youwonthebid.com/index.php
Just using the domain name
http://www.youwonthebid.com should still work fine with either extension.
Re: PHP mysterious problem
Posted: Wed Mar 05, 2008 12:45 am
by fearlesss
Thanks for that.
Is their anyway i can get php phrasing to work on the other server ?
I was really hoping to get it to work on both servers so i don't have to change
each file to .php as throught the site their are hundreds of pages
regards
josh,
Re: PHP mysterious problem
Posted: Wed Mar 05, 2008 1:38 am
by Christopher
For Apache, you can add "index.html" to the DirectoryIndex setting for the webserver either in the configuration file or .htaccess.
Re: PHP mysterious problem
Posted: Wed Mar 05, 2008 2:18 am
by Benjamin
arborint wrote:For Apache, you can add "index.html" to the DirectoryIndex setting for the webserver either in the configuration file or .htaccess.
You must be tired. I think you meant "AddType application/x-httpd-php .php .htm .html"
Re: PHP mysterious problem
Posted: Wed Mar 05, 2008 3:38 am
by Chris Corbyn
The technical term for "mysterious problem" is actually "voodoo"

I'll be enforcing this more strictly in future.
Re: PHP mysterious problem
Posted: Wed Mar 05, 2008 7:23 pm
by fearlesss
Well I should have just kept my mouth shut
This morning I checked both websites and neither of them have the php script working now

I jinx'd it .
"AddType application/x-httpd-php .php .htm .html"
I added this to both htaccess pages on both websites and it basically killed both websites
it couldnt find index.html and came up with a whole bunch of errors ?
was their something missing I didn't do ?
it really is a voodoo problem now .
I guess i'm just going to have to bite the bullet and take a whole day out changing each page
to .php
UPDATE !!
Ok stop looking guys
I changed the script to
AddHandler application/x-httpd-php .html .htm
And now php works on both sites !
For anyone else having problems with running php on html files heres what i came across
By default most web servers across the internet are configured to treat as PHP files only files that end with .php. In case you need to have your HTML files parsed as PHP (e.g .html) or even if you want to take it further and make your PHP files look like ASP, you can do the following:
For web servers using PHP as apache module:
AddType application/x-httpd-php .html .htm
For web servers running PHP as CGI:
AddHandler application/x-httpd-php .html .htm
In case you wish to do the ASP mimick:
For PHP as module:
AddType application/x-httpd-php .asp
OR
For PHP as CGI:
AddHandler application/x-httpd-php .asp
thanks guys
Re: PHP mysterious problem
Posted: Wed Mar 05, 2008 10:19 pm
by Ambush Commander
it couldnt find index.html and came up with a whole bunch of errors ?
Was it a 500 internal server error?
It's a good practice, anyway, to keep your PHP files labeled php. Having them as html is slightly voodoo-y; however, AddType should work.
Re: PHP mysterious problem
Posted: Wed Mar 05, 2008 11:44 pm
by fearlesss
it was a 500 error
Yeah I know, I've only just taken over working on the site and it needs alot of work.
But ild rather have a temporary fix for the mean time.
Then later on when I've got nothing to do ill start the process of changing all the pages to .php