Computing.Net > Forums > Web Development > PHP scripts set-up

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PHP scripts set-up

Reply to Message Icon

Name: horsemeeker
Date: September 17, 2004 at 08:03:11 Pacific
OS: win xp
CPU/Ram: 800/640
Comment:

I want to be able to have php scripts in my webpages, but i cant get things working...
e.g. (saved as test.htm):

<html>
<head>
<title>monkey</title>
</head>
<body>

<?php
echo "Hello World";
?>

</body>
</html>

I can only see a blank page when this loads. I have installed php as well as Apache and IIS, and things seemed to be set up right. Frontpage doesn't seem to recognise the php code. Do I need to edit the PATH variable? Whats going on??? Help!



Sponsored Link
Ads by Google

Response Number 1
Name: SN
Date: September 17, 2004 at 08:25:13 Pacific
Reply:

First, you'll have to save the file as .php, not .htm. The server will only parse the PHP if the file extension is associated with the PHP engine (in the web server, not windows).

If it still doesn't work, you may not have apache or iis set up correctly (use one or the other, not both. Apache is probably the way to go since you're using PHP)

There's no shortage of web tutorials on how to get PHP working with apache...Check out PHP.net.

Luck,
-SN


0

Response Number 2
Name: horsemeeker
Date: September 17, 2004 at 08:33:42 Pacific
Reply:

thanks, that seems to have got things working alot better.
only thing now is that to view my page, the file has to be in "C:\Program Files\Apache Group\Apache2\htdocs" and I only seem to be able to access it via http://localhost/test.php
Is there anyway that I can save the php file where I like, and then just open it as it is, rather than the whole localhost thing?
thanks


0

Response Number 3
Name: SN
Date: September 17, 2004 at 09:04:36 Pacific
Reply:

You can change apache's default directory to something else, but for the server to parse a file, you need to access it via http, which just loading it into the browser like a local html file doesn't do.

So the short answer to your question is No. However, I mostly use IIS so somebody else here who knows more about apache might have a trick I don't know about.

Good Luck,
-SN


0

Response Number 4
Name: horsemeeker
Date: September 17, 2004 at 10:22:20 Pacific
Reply:

I found a program called DzSoft PHP Editor, which seems to do what I need. You can preview what you're developing as you're doing it, rather than going through the hassle of working from a certain directory and then having to access it via localhost. So, I think I've now got things sorted.
Thanks for all the help.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Win98 for Server? browser cant display .tk ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: PHP scripts set-up

Setting up apache server w/php+mysq www.computing.net/answers/webdevel/setting-up-apache-server-wphpmysq/2743.html

PHP script www.computing.net/answers/webdevel/php-script/2710.html

Help setting up Apache and PHP www.computing.net/answers/webdevel/help-setting-up-apache-and-php/3750.html