Saturday, April 19, 2008

Writing and Running PHP Scripts

We’ve been talking about PHP for 2 days now; we even wrote a simple PHP script and understood its working. Now comes a big question, “How do we write and run PHP scripts?”. Do we need some special software to write PHP code? How do we run these scripts?

Let’s know the answers!

Writing PHP scripts

You don’t need anything special; really, plain old Notepad would do just fine. PHP is an interpreted language hence code remains as it is (not compiled) thus any plain text editor is fine. Although syntax highlighted text editors would be better.

If you are using a word processor instead, be sure to save the files as plain text files and not in the proprietary formats.

Notepad, as I said may be used but I don’t recommend using it, instead use code editors like Programmers Notepad, Notepad++(really great, supports numerous third-party plug-ins)that have syntax highlighting feature. That would make you easily understand the code and write it in a better way with proper indenting etc.

Though, I personally use Macromedia Dreamweaver which has decent syntax highlighting and IntelliSense type, on the fly, function reference, you are free to use any editor you like and feel comfortable with.

I’ve read some positive reviews about PHP Designer(Paid Software although there is a free lite version) but I reserve my comments because I’ve yet to use it.

As you can see, PHP is just like JavaScript in this case. Both are interpreted language and both don’t need any special software to write the codes in.

Running PHP scripts

In this case, PHP is way different that JavaScript. JavaScript is client sided hence interpreted by the browser; PHP on the other hand is server-sided which means a server is NEEDED to interpret its scripts. Be it somebody else’s server (Web hosts) or your own PC server (that you can install yourself).

There are 3 things that you can do to be able to run PHP scripts:

  1. Buy web space, most web hosts even the cheapest ones give PHP support

  2. Find a free web host that has PHP support. You can find plenty of them at

  3. Install your own web server on your own PC. This way your computer would act both as a server and a client. This according to most is the best way to learn PHP.

In the coming posts, I’ll give you a detailed set-by-step guide for installing your own web server along with PHP.

So till then good bye guys and thanks for reading!

Related Articles:

No comments:

Post a Comment

You are free to comment anything, although you can comment as 'Anonymous' it is strongly recommended that you supply your name. Thank You.

Please don't use abusive language.