Introduction to PHP Programming language
What is PHP: PHP is one of the most popular free and open source general-purpose scripting languages and it is particularly applied in web development. PHP stands for PHP: Hyper Text Preprocessor (it is a recursive bacronym). It is a server site scripting language meaning all the PHP code is executed on the server site(where the web-site is hosted) not client’s computer. The server generates HTML based on PHP code and then sends it to the client’s machine. The client receive only the plain HTML output of running PHP script, but never know what the underlying code is. It is also a platform independent language which means PHP runs on almost all the platform including Windows, Linux and UNIX. It is suitable for almost all the web-servers used these days.
The greatest things in applying PHP are that it’s incredibly simple for a new comer; however it provides many sophisticated capabilities for an expert web developer too. Never be worried reading through the long list of PHP’s functionalities. You can jump in and start creating simple scripts in a couple of hours.
What Can PHP Do: You can perform all kinds of things such as evaluating or validating form data sent from a web browser, connect to the database, building customized content to serve the browser, and even send or receive cookies. Although the main focus of PHP is on server site scripting, you can do a lot more with PHP.
There are 3 primary fields where PHP can be applied.
- Server site scripting: This is the most conventional and primary targeted area for PHP. Three things are needed to make this work properly. The PHP parser (CGI or server module), a web browser and a web server. You have to run the server, along with a connected PHP installation. However I recommend you to use XAMPP or WAMP for server site scripting. XAMPP and WAMP are two simple, lightweight software packages that make it very easy for web developers to create a local server in their own machine for testing purposes. Everything you have to install such as PHP, web server (Apache) and database (MySQL) is incorporated in a single and simple extractable file.
- Command Line Scripting: This is a way to make PHP code run without using any web server or browser. The thing you only need is the PHP parser. This kind of usage is useful for scripts that are frequently executed using cron (Linux) or Task Scheduler (Windows).
- Writing applications for Desktop: PHP is not the greatest language to make a desktop application with a GUI (graphical user interface), however if you learn PHP very well, and want to utilize some sophisticated PHP functions in your client-side programs you can also utilize PHP-GTK to create these kinds of programs. You can also create cross-platform programs in this way. PHP-GTK is an expansion to PHP, which is not available in the main PHP distribution. If you’re really serious in PHP-GTK, visit their official website at http://gtk.php.net
You are not restricted to output only HTML in PHP. You can easily output images, PDF files and even Flash movies using PHP. PHP also enables you to output any text, such as HTML, XHTML and any other XML file. PHP also has support for a wide range of databases such as MySQL, Oracle, NoSQL etc.