I feel a little like an idiot for asking this but....

I have Apache 2.2 installed on my computer just to test my pages and scripts for my web engineering class. Whatever version of PHP that came with it is what I have installed.

I can't even get a basic Hello world thing to work. Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>

<body>
<?php
	print "Hello world!";
?>
</body>
</html>

The above code is loaded as a plain text document. Anyone able to tell me why?

Recommended Answers

All 8 Replies

Did you give you file a .php extension or .htm? It needs .php in order to work.

if you added a .php extension create another file and call it info.php for example and place this code in it:

<?php
    phpinfo();
?>

if that doesnt work then PHP isnt installed properly

hello world:

just write:
<?php
echo""Hello World';
?>

and save with extension file .php

if you added a .php extension create another file and call it info.php for example and place this code in it:

<?php
    phpinfo();
?>

if that doesnt work then PHP isnt installed properly

i agree with Auzzie. check for ur php info

K, it looks like when PHP was originally installed, it wasn't setup with a server. Reinstalled it and now it crashes every time I try to run a script.

I'm running on Vista 64 Ultimate. Anyone know any issues with Apahce 2.2/PHP 5.2.5 on Vista?

What exactly do you mean by "crashes" ? Doesn't it execute or umm.. or what ?

one other thing, to save confusion with php running into mysql later in your training and to save loads of time now.
I would suggest downloading Wampserver
Its a great platform which is sooooo easy to install and contains - PHP - Apache and phpMyAdmin.
Go to ...
http://www.wampserver.com/en/download.php

seriously it saves so much time and its much easier

hope this helps

It says "CLI.exe has stopped working. Windows is trying to find a solution."

Then it pops up with a bunch of error messages.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.