tags:

views:

922

answers:

8

Hi

I want to do a sample program in PHP on Windows XP.

Do I need any special software to get this to work?

I am afraid that I simply open notepad type the PHP program and save it with php extension. Then I open it with the browser as a HTML file. But it does not work.

Please help

Thanks in advance

+5  A: 

You need to have a web server with PHP installed on your PC to make this work.

I highly recommend installing wampserver on your computer. It is a Windows installer that will put PHP, MySQL and Apache in your computer and let you manage all the services and such very easily. If you have problems getting it to work, you can also try out XAMPP, although I've never used it myself.

Paolo Bergantino
I prefer XAMPP for the ease of install and use. It has a control panel where you can start, stop, enable/disable as service, configure, monitor Apache, mysql, FTP server, Mail server (mercury) individually.
tharkun
WampServer has this too. Although no FTP server or Mail server, but who needs that... :p
Svish
A: 

Another easy one to set up (though it takes extra config to support PHP5) is easyPHP

alex
A: 

you can simply install PHP, and then run the program and redirect the output

php foo.php > output.html

and then use any browser to open up that html file.

動靜能量
Personally I wouldn't call that "simply" :p Especially when it is so easy to get a webserver with php up and running on windows...
Svish
+5  A: 

However you decide to install a webserver and php (or just php and use it in the console like someone mentioned):

Apache (Very, very easy)

  1. Check out the WampServer getting started presentation.
  2. Download and install WampServer.
  3. And you are ready to go.

Microsoft (Not tested this myself)

  1. Check out PHP on Windows.
  2. Download and install the Microsoft Web Platform Installer.
  3. Let me know how that work out... (never tried it myself, since WampServer is so easy)
Svish
... why did I get a downvote here? If there is something wrong, incorrect, bad about my answer please don't just vote me down. Leave a comment as well! How else am I supposed to learn... =/
Svish
A: 

Since you have IIS on the windows cd I would suggest you go to control panel, install/uninstall programs and click on windows components and install IIS. Then install ASP.NET 3.5 from www.asp.net and finally install Phalanger from http://www.php-compiler.net/

That will give you the benefit of both worlds, you can program in ASP.NET using PHP as the language, you can use only PHP if you prefer that or you can mix using ASP.NET/C# on some pages and PHP on other pages within the same application.

PQW
+1 for the nearly entirely native way to host PHP locally. Having installed both IIS and Apache on XP, however, I personally lean in favor of the Apache solution and the (new to me) wampserver packaging of all the pieces in one installer makes that an even more attractive idea.
RBerteig
A: 

I use XAMPP, works out of the box with his installer and is more than enough for a simple developer windows environment.

0plus1
A: 

The simplest way - use www.microsoft.com/web platform installer. get the whole stack to run PHP all from one place.

+1  A: 

Some answers containing the hint for using wamp. You should better use the Zend Server Community Edition.

This is also free and can be downloaded here: http://www.zend.com/de/community/zend-server-ce

This contains Apache, Mysql, PHP and some Zend related Tools. Benefit: its much better preconfigured than wamp.

Bernd Ott
I've been wanting to check out the zend framework for a while, didn't know about this. Thanks!
Svish