Page 1 of 1

Test PHP locally

Posted: Sat Mar 18, 2006 5:23 am
by lyleyboy
I am fairly new to PHP. I have built a few scripts and uploaded each stage to test it. Is there a way I can test PHP offline on my local win XP machine?

Thanks

Re: Test PHP locally

Posted: Sat Mar 18, 2006 7:05 am
by Chris Corbyn
lyleyboy wrote:I am fairly new to PHP. I have built a few scripts and uploaded each stage to test it. Is there a way I can test PHP offline on my local win XP machine?

Thanks
Yes...

You need a HTTP server and PHP installed.

HTTP server will most likely be one of IIS (Built in to windows XP pro) or Apache (Downloadable from http://apache.org/ ).

PHP is available freely at http://php.net/

I'd advise using Apache with PHP.

Posted: Sat Mar 18, 2006 8:17 am
by matthijs
And the lazy way: click install complete package http://www.apachefriends.org/en/xampp.html
or even put everything on an usb stick and be able to switch between php 4 and 5 : http://www.chsoftware.net/en/useware/wos/wos.htm

Posted: Sun Mar 19, 2006 5:07 am
by lyleyboy
matthijs wrote:And the lazy way: click install complete package http://www.apachefriends.org/en/xampp.html
or even put everything on an usb stick and be able to switch between php 4 and 5 : http://www.chsoftware.net/en/useware/wos/wos.htm
Thaks for that. I have done what you suggested but when i try to open a php file all i get is either the code or if I place the file inside the iis server I just asks me to download it. CAn anyone help.

Posted: Sun Mar 19, 2006 5:39 am
by matthijs
Which package did you install and how? Did you install it locally or on an usb?

For the last: here's some good instructions:
http://www.tamba2.org.uk/wordpress/usb/
it also deals with installing wordpress, but the steps before that are exactly what you need.

If installation went well, don't forget to take the steps:
- start server (duh :) )
- go to localhost in your browser. browse to your page. it doesn't work if you open a file directly

Test PHP locally

Posted: Sun Mar 19, 2006 8:14 am
by lyleyboy
Hi,

I followed the second step of your initial advice. I downloaded the exe to my desktop and ran it from there. It seemed to install ok. When the server control panel starts the MySQL runns fine but the apache runs for a secong and the stops.

I have put the files into localhost a browsed to them. This just pops up the download dialog.

I'ts prob me doing somthing daft.

Posted: Sun Mar 19, 2006 9:03 am
by matthijs
Did you check out http://www.woswiki.chsoftware.net/index ... leshooting? There are some common problems described.
And did you install the whole package in the same directory?

I have had some trouble myself when I tried to change some settings. Sometimes it has something to do with the environment etc.

Failed

Posted: Sun Mar 19, 2006 9:22 am
by lyleyboy
OK, Im getting it all installed and a green running box next to the MySQL server. When I try to start the Apache server is goes gren for a second and then stops. Is this my problem. I had thought it could be realted to my firewall, so I unistalled disabled he firewall and tried again. Same effect.

I think its time to quit.

Posted: Sun Mar 19, 2006 10:47 am
by timvw
My first guess is that you already have IIS running.. And that Apache can't bind to port 80 anymore..
Solution1: stop the IIS server when you start Apache.
Solution2: Bind one of the servers to a different port.