A B C Of PHP
- PHP stands for Hypertext Preprocessor.
- It’s a server side scripting language, like ASP.NET, JSP, Perl etc.
- It is an interpretted language, means no need for compiling PHP programs before executing them.
Current version while writing up this post is PHP 5.3.2.
Basic Funda Of PHP
Step1: Assume you open your web browser and type in any URL (let it be ultimatechange.co.cc). So now your web browser will send a request to the corresponding server (of this URL).
Step2: The web server on the other hand receive this request. It spots out that this URL ends with “.php” extension and so it send this request to the PHP interpreter which is present in the server only (consider the interpreter to be a part of server for now).
Step3: The PHP interpreter accepts the request send to it by the server. It then starts executing whatever PHP-tags are associated with that particular request (hope you have little idea about tags, if not then consider it to be as some code for now).
As execution is completed the response (result) is sent back to your browser. And finally what you get to see is ultimatechange.co.cc blog or whatever you have requested for.
What Makes It Special?
Server Side Player: As discussed above PHP code is processed at the server side and not on client’s browser. Now this may sound you very normal thing, but even this little thing make a big difference. How? Actually what happens is for all client side scripting languages(yes the one which are executed at your end) a complex logic is required for providing browser specifications. But with server side scripting like PHP, anyone can easily write any program irrespective of client’s browser specifications.
Source Code Privacy: Yeah that’s another remarkable feature of PHP. And the credit for this again goes to server side scripting only. As all the PHP-tags are processed at the server side and only the result is send to the client, thus hardly you can see what’s the source code of the webpage is.
Generally WAMP server is used when you want to try out your hands with PHP on windows. This WAMP server basically comprises of 4 components Windows, Apache, MySQL, PHP.
Now you might be amazed by reading out all these components, some of us will say when we can easily write out this PHP at notepad then why we will require all this things? So to answer your this query i want to drag your attention back to “Funda of PHP“, over their i told you that you client working on your system, request server which passes ahead the same to interpreter and so on.. So now considering you as a beginner to this language, i will recommend you to first practise out your PHP scripts on your system only. And once you have enough practice with it, then definately you can move on by simply writng PHP in notepad and then uploading files on FTP sever.
So for building and then testing all your PHP scripts locally on your machine, requires a specific environment comprises of:
- An operating system where client work and a server environment(usually linux).
- A webserver (usually apache on linux, while IIS on windows).
- PHP interpreter to process all PHP codes.
- Database (MySQL) to hold all data.
And that’s the reason why we choose WAMP server( for windows) or LAMP server (for linux).