Page 2 of 2

Posted: Sun Dec 02, 2007 12:29 am
by srod
traumatic wrote:
srod wrote:

Code: Select all

System  Windows NT IIS6110 5.2 build 3790  
Sincere condolences! ;)
:)

Posted: Sun Dec 02, 2007 1:20 am
by Mistrel
I think you misunderstand the purpose of the <?php... ?> tag.

This tag is meant to be used in a .php or other file type that's recognized by the web server. A .php file is no different from a .html file other than the fact that it passes through the php parser. The parser knows what to act upon by what is encased in php tags.

To use the php tags in a .html file is backwards thinking. Just name your files .php.

A good book on PHP is Sam's Teach Yourself PHP in 24 Hours.

Posted: Sun Dec 02, 2007 2:50 am
by srod
The <?php ?> tags can be embedded in ANY file which is passed to the php engine; anything not enclosed within such tags is ignored by the engine. My problem is getting my remote server to pass html files to the php engine; with Apache - no problem. With IIS...

There are good reasons for wishing to embed php code within a html file; as explained in Sam's Teach Yourself PHP, MySQL and Apache!
:wink:

Now, I need a php script to run immediately before my main page loads in a user's browser. The options, in the absence of the desired solution of having html pages sent to the php engine, therefore, are either to rename my main page www.MyWebsite/index.php which is pretty horrendous for a user having to type that in, or use redirection - which is what I've done. The redirection works very well.

Course, if the user has disabled scripting...

Posted: Sun Dec 02, 2007 7:00 am
by Mistrel
The php parser can read tags from any file type passed to it, yes, but for what reason do you need it to read .html?
The options, in the absence of the desired solution of having html pages sent to the php engine, therefore, are either to rename my main page www.MyWebsite/index.php which is pretty horrendous for a user having to type that in, or use redirection ..
You shouldn't have to. I can't speak for IIS but Apache will automatically recognize your index.php page by typing just www.MyWebsite.com, unless you have a conflicting index.

Apache will load an index page by order of importance .html/.php/.htm, in that order.

I'm going to guess that you can't get your index page redirected to simply by typing your website name? If you already have an index.html file in your website's root directory your php page won't load first.
The redirection works very well.
Only for those users who have Javascript enabled.

Maybe I'm not understanding the question. Why is it imperative that your web pages have the .html extension?

Posted: Sun Dec 02, 2007 11:58 am
by srod
You shouldn't have to. I can't speak for IIS but Apache will automatically recognize your index.php page by typing just www.MyWebsite.com, unless you have a conflicting index.
Well bugger me, I didn't know that -and yes, that works fine! Very nice. :)

Now why the hell didn't I think of even trying that?

That's what it means to be new to all of this Apache and php stuff! :wink: Still, it's good fun learning.

Thanks Mistrel.

Posted: Sun Dec 02, 2007 4:26 pm
by LuCiFeR[SD]
you know, thats what I was trying to tell you last night, but I'd had a skinfull lol :P

Posted: Sun Dec 02, 2007 9:12 pm
by srod
Sorry Lucifer, I think you were indeed saying that I should simply use index.php instead of index.html, but I didn't realise even then that the php file would be loaded automatically if the html file was absent!

And I have no excuse because I hadn't touched a drop! :)

Posted: Tue Dec 04, 2007 4:12 am
by PurePWNRER
traumatic wrote:I'm not sure if I fully got this right, but if it's a windows server chances are
high that it's not even running apache but IIS instead.
If so, there's no .htaccess available.

If the server is running apache, your provider should really allow you to
access the .htaccess. I've never come across any provider that forbids
that. I mean, how do you setup error-documents for example?
And you came from the past?, IIS supports .htaccess, mate.

Posted: Tue Dec 04, 2007 8:25 am
by traumatic
PurePWNRER wrote:And you came from the past?, IIS supports .htaccess, mate.
Does it, mate? Since which version, mate? Do you have any link for me to read, mate?

Posted: Wed Dec 05, 2007 5:55 am
by Dare
traumatic wrote:
PurePWNRER wrote:And you came from the past?, IIS supports .htaccess, mate.
Does it, mate? Since which version, mate? Do you have any link for me to read, mate?
Well, PurePWNRER has been back and pooped on a few more doorsteps. Wonder why he hasn't responded here. :D


Maybe he is hunting down that link for us. We wait in anxious anticipation!




BTW, wouldn't it be great if IIS supported something like that? Save on all that manual or scripting pooting around. But then perhaps it would all be too easy.

Posted: Thu Dec 06, 2007 11:23 am
by traumatic
Maybe we're not worth it or something...

Posted: Sat Dec 08, 2007 2:28 am
by mrjiles
I'm pretty sure IIS doesn't use a .htaccess file ... first off, have you ever tried to name a file in Windows that begins with a period (.)? I think everything is stored in a database.

IIS should have a spot to set the default page(s) though (website properties maybe?)