Few things to know before starting-up with PHP
❗ As the title suggests, this post is targeted to the students or professionals who want to start working with PHP, but here are certain things to know before setting up! This is not a PHP tutorial.
Alright! before starting with this post, I’d like to tell you something.. If you’re a novice to PHP and think, is it a right time to learn PHP? Is it too late? If your answer is a big NO for these questions, then it’s fine, but if silly thoughts are not letting you sleep at night and come in your dreams :shock:, just flush ’em out. What I personally believe is, it’s never too late to start learning a new thing. So if you ever see an expert in a particular field, then don’t mumble, “I wish I could also be like him/her”. That person has also learned it from scratch some day and reached the milestone where he is now. Just believe in your internal (hidden) powers, and get to work. Motivate yourself and say, “Do it!!!” (my way ;))
Let us come to the point.
PHP (acronym of PHP Hypertext Preprocessor) is a server-side scripting or a programming language (“C” like) used to create dynamic web pages on the fly. It is becoming more and more popular to create web mail systems, blogging sites, user forums and E-commerce sites. It offers database connectivity with databases like MySQL and many more.
Some ultimate features of PHP:
- Free and open source
- Fast, stable and cross-platform
- Requires no compilation (as compilation slows down the process)
- Easy to use but extremely powerful
- Number of PHP editors are available (try to Google “PHP editors”)
- A large and open community (where you can ask queries and discuss with other PHP professionals)
- Help – http://www.zend.com/
- Object oriented
- Extended to PHP 5
💡 As of now, the current stable release is PHP 5.3.2. PHP 6 is still under development and only God knows when it will be released :-?.
As PHP runs in the client-server environment, following is the data-flow diagram which shows you PHP in action.
Let us dig this out.
Browser – Web server connectivity:
The work of browser is to display some content with the help of which you can interact with the web server. The web server needs some kind of scripting/programming language to process the data (PHP in this case). Information is stored somewhere in the server. In the browser – web server communication, dynamic things can happen such that converting the text to PDF, performing calculations, etc. The results are then sent back to the browser. Browser may also contain some flash generation programs for better presentation.
❗ The presentation server is optional in this architecture and is used in sophisticated environment and bigger applications.
It is very much similar to the web server and is used to create advanced web applications. Generally speaking, it uses Java programming language or Microsoft’s .NET programming platforms. PHP web server can communicate with presentation server just like the database server. And its important role is to share the load on the PHP web server to create files.
PHP supports database connectivity. Hence it requires a database server. PHP web server sends or grabs data with the database server and sends or receives data to the web browser.
With the help of this kinda flow, we can add more dynamism to the web pages.
Software you need:
- A web server: Apache or IIS (Internet Information Server) – Both works in the similar fashion with a subtle difference. IIS works with Microsoft technologies (closed source! :mad:) and Apache server is cross-platform and hence more preferred.
- PHP: You can always download a latest and stable release of PHP from http://php.net/
- MySQL: Get the latest news and downloads of MySQL at http://www.mysql.com/
- PHP text/web editor: As I said earlier, you can always Google for “php editors” and choose your favorite one depending on your taste. Some popular test editors are PSPad, Notepad++ (Windows lovers), Kate (Linux platform), etc. Advanced users can simply opt for Eclipse or NetBeans (NetBeans is my first love by the way :wink:).
- Other optional software tools like PHPMyAdmin. PHPMyAdmin allows us to administrate the database locally all over the web directly within a web browser. It’s a great way to deal with MySQL.
- Operating system like Windows, Linux or Mac OS.
💡 Conclusion: All of the above unitedly provide an open source solution.
Installing Apache, MySQL and PHP individually are harder to configure for the beginners. For that reason, they can go for the following server packages:
- XAMPP :- An OS, Apache, MySQL, PHP (an extra ‘P’ for pro) (http://www.apachefriends.org/en/)
- WAMP :- Windows, Apache, MySQL, PHP (http://www.wampserver.com/en/)
- LAMP :- Linux, Apache, MySQL, PHP (no special server package available. You can install manually or can go for XAMPP)
- MAMP :- Mac, Apache, MySQL, PHP (http://www.mamp.info/en/)
My advice to you is “Use whatever floats your boat!”
So now, you are all ready to get your work start with PHP. In this way, we’ve learned few things before starting-up with PHP. For the detailed PHP tutorial, you can follow these many links:
- The one and only and most recommended PHP’s official manual i.e. http://php.net/manual/en/
You can always contact me for the further queries related to this post. Be healthy and keep smiling! 🙂