Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complete newbie first attept

Status
Not open for further replies.

martinstan

Technical User
Jan 12, 2005
19
0
0
GB
Hi
I'm learning all this from a book and I've run into problems straight off. I've installed apache and php on windows XP pro and I'm trying to set up a testing environment. My Document root directory is left at htdocs and in this I've placed a folder called test. In this I've placed a basic html file called index.php. I open my browser and type the following and I get the following window ? you are downloading the file: test from localhost, would you like to open, save,cancel?
if I place a file called index.html then the file opens correctly.
Can anyone tell me where i'm going wrong?
Thanks
Martin
 

DirectoryIndex sets the what is looked up with a trailing / and you probably want to add index.php

gene
 
Hi Gene
Thanks for your help. I've already added index.php to the httpd text along DirectoryIndex. Is this where you mean?

DirectoryIndex index.html index.html.var index.phtml index.php

Thanks
Martin

 
Yes, that's where it needs to be. Did you restart apache after this change?
 
Guys
thanks for you help. From what I an see I've haven't done much wrong here. This is what's a bit weird and might shed some light on this...
If I remove the index.php file from test folder, and replace it with index.html enter into browser then index.html opens fine. If I then remove index.html from the test folder and replace with index.php then hit refresh, my index.php opens just fine. Is there a setting within IE6 that could cause this? I've tried turning off any firewall and antivirus and tried using Netscape as an alternative but no joy.
Thanks again
Martin
 
Either there is a mistype in the last post or it is very late at night, but what you describe seems to be the behaviour you desire or am I missing something?

You type in and
if index.html is present that appears, or if index.html is not present but index.php is present then index.php appears correctly?

That is DirectoryIndex's function in life, to search for possible default index pages.

gene
 
Hi Gene
Sorry If I mislead you with my last post. What I mean is that the index.php file will not open independently (i.e if it's the only file in the test folder(don't ask me why I tried this) but it will open if I initially open an index.html, leave the browser window open, remove the index.html, replace with index.php in the test folder and then hit refresh. If i just try and open index.php straight off then I get the 'downloading file' window.
Let me tell you what I do. I open Apache consol, open browser window, and type the following (test folder being inside htdocs folder and containing index.php.

Thanks for your help. I'm really looking forward to getting this underway.
Martin
 
This sounds like apache doesn't know what to do with the php file.

Look in httpd.conf for something similar to:

Code:
    AddType application/x-httpd-php .php

If you do not have this, apache doesn't know what to do with the file (and it may serve it as a download, instead of processing it.) It sounds like it half-works though, which is kind of odd.
 
Hi
I really appreciate all your help with this. It's great. I'm at work at the minute so can't check this. I do remember adding this line of code .. AddType application/x-httpd-php .php. Maybe I've made a typo?? So I'll check. The other idea I've found on the web is to clear my cache and history from IE. Does this sound a likely source??
Thanks again. I'll post my results whatever.
Martin
 
Hi
I'm still getting the same problem here so I've pasted in the code I've edited in thehttpd.conf file. Can anyone see anything wrong? Can I just check something.Within the conf folder there is another file called httpd.default,right? 2 other quick points. 1)if I type into to the browser I get the Apache test page which is good. 2)the only other thing that has change ever so slightly in the installation is that when I edited the conf file I did it in wordpad and so the file is now showing as a wordpad page..it still has a .conf extension. Could this have any effect??
Thanks again
Martin

DirectoryIndex index.html index.html.var index.phtml index.php

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php "/php-exe-location/php.exe"
ScriptAlias /php-exe-location/ "c:/php"

AddType text/plain .txt
AddType application/x-tar .tgz
 
That might have an affect. It is possible that Windows isn't showing you the true file extension. Find that file in Windows Explorer, right click on it and go to properties.

It will tell you if the extension is .conf - however if wordpad changed the extension I don't think apache would start at all.
 
I'm trying to run Apache, on windows server 2003, when I try to start it i get error (os2) the system cannot find no installed service named apache2, I'm not sure were to go from hear.
 
starmark: It's better to start your own thread.

As per the httpd docs, use

Code:
apache2 -k install

From the apache bin directory.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top