PHP Doc Root

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Snorii

Thread Starter
Joined
Aug 16, 2002
Messages
90
I have Apache installed and running on XP. I also have PHP 4 installed and working (kinda).

I have Apache pointing to a folder called public_html where I keep my html files etc for my web page. I also put a few very simple php programs there. When I pointed my browser to them, I got an error, "File input not specified."

Well, what I did to fix it and I'm not sure I did the right thing was go into the php.ini file on C:\WINDOWS and edit the following line:

doc_root = "C:\...\public_html\phpWeb"

Now if I put php files into the folder called phpWeb they run just fine. But if I try and open a php file that is located anywhere else (e.g. ...\public_html\phpWeb\catalog) it will not work.

Am I overlooking something obvious or do I need to somehow make doc_root to point to more than one folder?

As I was writing this, I thought about changing it to

doc_root = "C:\...\public_html"

but I'm not certain that will work either. But at any rate, thanks for any input and I will get back with you on my new idea.

- Snorii :)
 

Snorii

Thread Starter
Joined
Aug 16, 2002
Messages
90
OK, I fixed the other problem by uninstalling everything and installing PHPTriad. It installs Apache, MySQL, and PHP at the same time. Everything was working beautifully.....except php code embedded in html files. I figured out how to get apache to execute the embedded code by making a little change in the httpd.conf file. I changed it from

AddType application/x-httpd-php .php

to

AddType application/x-httpd-php .php, .html

and I thought everything was working. Now I notice that .php files won't work. It just sends the code to the browser. My little test.php file

PHP:
Today is <? print strftime("%m/%d/%Y"); ?>
prints the code out rather than correctly saying "Today is 02/08/2003".

How can I get both .php and .html files to work properly in the apache environment? I know it just has to be a line or two in the httpd.conf file, but I don't know what to change it to.

Thanks for any help,
Snorii
 

Snorii

Thread Starter
Joined
Aug 16, 2002
Messages
90
OK, I figured it out.

In the httpd.conf file, I changed it to

AddType application/x-httpd-php .php
AddType application/x-httpd-php .html

I had tried this before, but there must have been some other problem. Now everything is working, but about that MySQL database...... ;)
 
Joined
Nov 2, 2000
Messages
637
gop to sitepoint.com and look for their sample chapters for the book on MySQL and php. You can download the first four chapters and they walk you through a step by step installation very easily.

My question for you is were you putting php code into a file with .html ending? If a page has php code in it you should just name it with a .php extension.

On another note, all files need to be in the server root in order to be served by the server. I would leave it that way as it prevents other files (such as those in C:\windows) from being servered to anyone that hits the web server.

HTH
 

Snorii

Thread Starter
Joined
Aug 16, 2002
Messages
90
Originally posted by deuce868:
gop to sitepoint.com and look for their sample chapters for the book on MySQL and php. You can download the first four chapters and they walk you through a step by step installation very easily.

Thanks for the link. I got MySQL up and running. It works fine. PHPTriad really does a nice job of installing all three applications even if it is beta. :D

My question for you is were you putting php code into a file with .html ending? If a page has php code in it you should just name it with a .php extension.
I was wanting to do it both ways. (I'm really not sure why since .php files worked fine.) But I had a file named index.html.
(The following is actually html, but I don't see any other way to insert html code using vB code.)

PHP:
<html><head><title>TEST</title></head><body><h1>Howdy</h1>Today is <? print strftime("%m/%d/%Y"); ?> </body></html>
Since I added the other line to httpd.conf, this works now.

On another note, all files need to be in the server root in order to be served by the server. I would leave it that way as it prevents other files (such as those in C:\windows) from being servered to anyone that hits the web server.

HTH
Yeah, they are all in the same place and some are in subfolders, but it all works great now. I'm very happy. :D Thanks for the reply deuce.
 
Joined
Aug 8, 2001
Messages
413
Originally posted by Snorii:
OK, I figured it out.

In the httpd.conf file, I changed it to

AddType application/x-httpd-php .php
AddType application/x-httpd-php .html

I had tried this before, but there must have been some other problem. Now everything is working, but about that MySQL database...... ;)
Just a point here, before you were seperating the file extensions with a comma but you just use a space.
Code:
AddType application/x-httpd-php .php .html
will have the same effect one one line :)
 

Snorii

Thread Starter
Joined
Aug 16, 2002
Messages
90
Thanks for the tip. I changed mine to one line and it works fine.
 

TechGuy

Mike
Administrator
Joined
Feb 12, 1999
Messages
14,672
Hey, Snorii... thanks for sticking to your own thread and letting us know how you figured things out!!!
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top