Page 1 of 1

Testing php

Posted: Wed May 19, 2010 4:47 pm
by Imosa
I am working on developing a website in php. I am very new to the whole process of working with servers and the internet but I did a lot of self education. Because of this, I believe that there are a lot of misconceptions in my understanding of how the whole process works.
My question is: Is there a way to test php without installing apache?
I think the answer is no so I will explain my situation as best I can.

On a school computer that I work on, I installed apache and php, making the computer a server with php. At that point I can go onto the the computer, save my php files in the document root and run them by using a web browser and the IP address 127.0.0.1 to connect to the server that is my computer.
Now I am at my home computer where I would like to continue testing the code for my website. So I try to install apache and I realize that I need to enter a Network Domain and Server Name. If am planing to install apache and php on my computer, thus making my computer a server with php, and then using my code in the same way I do at school. Do I actually need a real Network Domain and Server Name? Is there something else I can put into those spaces?

Again, because I taught all this stuff to myself I believe there are probably some holes in my understanding of the situation and what I am trying to do here. The big goal is that I just want to be able to test my php code.

Re: Testing php

Posted: Wed May 19, 2010 5:20 pm
by John Cartwright
You do not need a webserver to use PHP (CLI), however, to serve it through HTTP then yes, you would need a webserver.

Your best bet is to install a self-installer which handles all the configurations for you (includes apache2.2, PHP 5.31, MYSQL 5.1, etc). We use XAMPP around here.

Re: Testing php

Posted: Wed May 19, 2010 5:28 pm
by Imosa
John Cartwright wrote:You do not need a webserver to use PHP (CLI), however, to serve it through HTTP then yes, you would need a webserver.

Your best bet is to install a self-installer which handles all the configurations for you (includes apache2.2, PHP 5.31, MYSQL 5.1, etc). We use XAMPP around here.
Well I don't necessarily want it through HTTP. I just want to test it. I will check out the link you gave me.

Re: Testing php

Posted: Wed May 19, 2010 5:44 pm
by John Cartwright
If you don't want it through HTTP, and strictly want to test your PHP code, then take a look at the CLI

Re: Testing php

Posted: Wed May 19, 2010 7:16 pm
by Imosa
John Cartwright wrote:You do not need a webserver to use PHP (CLI), however, to serve it through HTTP then yes, you would need a webserver.

Your best bet is to install a self-installer which handles all the configurations for you (includes apache2.2, PHP 5.31, MYSQL 5.1, etc). We use XAMPP around here.
I realize that this may not be the right place to ask this but after I ran the installer for XAMPP my Document Root did not change. I still get the document root from apache. XAMPP sounds much easier then setting all this up myself.

UPDATE:
Alright, I uninstalled apache, then reinstalled XAMPP. html works, php works, tomorrow I'll be able to see if my other stuff works (uploading, downloading, and the zip library).
Thanks a million John. XAMPP may even be able to help my school with it's problems regarding this process.