...

View Full Version : PHP Testing



epicentric
09-13-2011, 04:06 AM
Hi folks,

This question may have already been asked but I haven't seen it as of yet.

I'm not a coding expert and I'm egar to get in to it more, but I don't want to pay a monthly subscription to a website, just to test my coding.

Most free websites give you the annoying templates and don't accept anything other than HTML.



Is there a website / freeware that I can download to test it in? So far I've been learning the theory, no practise yet :(

BluePanther
09-13-2011, 04:32 AM
Why not run your code from your local machine? I'm guessing you use windows, look up WAMP. That will give you all the tools you need to run a local web server.

And/or, codepad.org is a great tool that I use quite a bit when answering questions here and for many other tasks. It allows you to run code (obviously you can't use mysql, sockets or other such functions) for multiple languages - php happens to be one of them :). It also gives you the ability to save snippets, and share snippets with other people.

tangoforce
09-13-2011, 01:38 PM
There are several varieties of WAMP the two most popular are XAMPP and (IMO) the uniformserver. Both will turn up on google.

They contain everything you need: Apache (Webserver), PHP (script programming language), MySQL (Database engine) and a sendmail variant (for connecting via SMTP and sending emails through PHPs mail() function).

With both wamp systems you can run them manually via a script or install them as system services (which means they run in the background before you logon to your machine and they continue to run if you logoff). Both systems are suitable for hosting your website to the public not just testing however if you choose to do this ensure you have a firewall and I highly recommend running the wamp in a virtual computer - preferably on a seperate physical machine if you have one spare. For testing though you'll be fine running it on your main machine.

Also, there are a few websites that allow you to test and run PHP code online in your browser. freephptest.com is the first one that springs to mind. You can't use sockets or connect to a database but you can test out other bits of code (eg testing a function) which is very convenient.

As far as an editor goes, I use notepad++ which supports many languages and also allows you (with a pretty hard to find plugin which I can supply if you can't find it) to debug your php using xdebug. This allows you to inspect the values that variables hold at runtime and step through the code line by line.

@BP: I just tried codepad.org and for my code I used:


print 'test';


Shockingly the actual output was : print 'test';
http://i54.tinypic.com/25frgqc.jpg

In other words it didn't run any code. Thats either intentional or its broken.

BluePanther
09-13-2011, 09:00 PM
There are several varieties of WAMP the two most popular are XAMPP and (IMO) the uniformserver. Both will turn up on google.

They contain everything you need: Apache (Webserver), PHP (script programming language), MySQL (Database engine) and a sendmail variant (for connecting via SMTP and sending emails through PHPs mail() function).

With both wamp systems you can run them manually via a script or install them as system services (which means they run in the background before you logon to your machine and they continue to run if you logoff). Both systems are suitable for hosting your website to the public not just testing however if you choose to do this ensure you have a firewall and I highly recommend running the wamp in a virtual computer - preferably on a seperate physical machine if you have one spare. For testing though you'll be fine running it on your main machine.

Also, there are a few websites that allow you to test and run PHP code online in your browser. freephptest.com is the first one that springs to mind. You can't use sockets or connect to a database but you can test out other bits of code (eg testing a function) which is very convenient.

As far as an editor goes, I use notepad++ which supports many languages and also allows you (with a pretty hard to find plugin which I can supply if you can't find it) to debug your php using xdebug. This allows you to inspect the values that variables hold at runtime and step through the code line by line.

@BP: I just tried codepad.org and for my code I used:


print 'test';


Shockingly the actual output was : print 'test';
http://i54.tinypic.com/25frgqc.jpg

In other words it didn't run any code. Thats either intentional or its broken.

The annoying thing about codepad, is for PHP you have to wrap in <?php to execute. It's a minor annoyance though haha.

Personally, I don't like notepad++. I prefer netbeans, which has xdebug support built in. Also has some convenient version control utilities using SVN, mercurial and one other whose name escapes me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum