Setting up PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dydor
Forum Newbie
Posts: 4
Joined: Thu Feb 26, 2004 4:27 pm

Setting up PHP

Post by dydor »

I've set up MySQL, Apache, and PHP4 on Windows 2000. Everything seems to be installed, and the first two are working. PHP is installed also, but Apache does not parse my PHP script. The test-file phpinfo.php produces the expected output, but none of my 'hello world' type efforts do.
Is the problem most likely in the Apache httpd.cof file, or is it maybe my script that is wrong?
Sorry if this is a too simple question!
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

umm.. let's see

#1. are you putting the php files in the HTDOCS directory ?
#2. When you try to load a php file, does it only show the code?
#3. Are you getting any errors?
#4. Is apache loading ok ( and not erroring out) ?
dydor
Forum Newbie
Posts: 4
Joined: Thu Feb 26, 2004 4:27 pm

Post by dydor »

Thanks for the reply. Apache is starting and working fine. My file hello.php is displaying the html in the browser, but leaving out the part enclosed in the <? php ?> tags. It's in the HTDOCS directory, and I'm not getting any errors.
And Albert's right as usual!
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

this might seem a bit stupid, but its always the easy things that get u

when u open up the page in the browser, are you opening it straight from explorer? if u are, it wont work. you should use the localhost ip address, of if you arent on the computer itself, the ip address of the server

localhost ip address: 127.0.0.1

when u view thru explorer, it doesnt activate apache, but when u view through the ip address, then it is activated

also, since the test file phpinfo.php is in your htdocs folder, you will need to say

http://127.0.0.1/phpinfo.php

to make sure that it goes to that page

hope this helps
dydor
Forum Newbie
Posts: 4
Joined: Thu Feb 26, 2004 4:27 pm

Post by dydor »

Thanks Deemo. I've tried it both ways, the phpinfo.php file works, but my 'hello world' type scripts don't.
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Post by Dr Evil »

Could you show us your Hello World type script please ?
Is it in the correct folder (I think you might have been asked before)

Dr Evil
jigaruu
Forum Newbie
Posts: 21
Joined: Wed Feb 18, 2004 11:46 pm
Contact:

Post by jigaruu »

Do one thing try to browse some other already working file, then it wils show you the exact error and u can then track out the exact problem.
dydor
Forum Newbie
Posts: 4
Joined: Thu Feb 26, 2004 4:27 pm

Post by dydor »

Many thanks all! I got it working with the following address -
http://127.0.0.1/hello.php
I also set the ServerName in the apache conf file to 127.0.0.1, which it seemed to like - don't know if it's strictly necessary......
Thanks again.
Post Reply