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:
-
Buy web space, most web hosts even the cheapest ones give PHP support
-
Find a free web host that has PHP support. You can find plenty of them at http://www.free-webhosts.com/
-
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: