Sunday, 14 August 2011

Best Introduction to PHP And Also Using PHP.


PHP (the acronym is "recursive" and refers back to itself--it stands for PHP: Hypertext Preprocessor) is a popular server-side scripting language. The fact that it is "server-side" means that special software on the web server is used each time a page with PHP is processed. This software responds to specific commands included within (embedded) in the webpage. Generally, these commands tell it to generate new HTML code which is sent back to the user's web browser. Thus, especially when it is connected to a database on a web server, PHP can be used to generate dynamic web content. There are other uses for PHP that do not involve the internet, but this use of PHP is the most common one today. (Coggeshall)


Like some other technologies, PHP is not tied to a specific software vendor, meaning it is relatively compatible with other technologies and databases. This, and the fact that PHP requires relatively simple software to write and run, makes it a popular choice among programmers, who are seeking something more interactive and dynamic than JavaScript, but not as complex or tied to a single company as ASP.NET. Though there is no formal technical specification for PHP, it is maintained de facto by The PHP Group. (PHP: Introduction)


Examples: Like ASP.NET, PHP is broadly used, especially by small and moderately sized websites. Indeed, the original meaning of PHP was Personal Home Page tools, as it was originally built for the maintenance of the personal website of its creator, Rasmus Lerdorf. PHP is also particularly prevalent in online web discussion boards. All PHP pages end in .php rather than .html or .aspx.



Using PHP


PHP requires software to run, whether it’s on the web server or on your computer. A good guide to installing this software (if you’re installing it on your computer, you’ll be installing a server as well) can be found from Christopher Heng.

PHP can be written in a simple text editor, as it is embedded in the HTML. As with JavaScript, we’ll give a brief example of how to create a sample page, one that offers a welcome message to the viewer. Within the body of a normal HTML page, you can write a PHP tag like this one:

<?php echo '<p>Hello Visitor!</p>'; ?>

If the PHP software is installed on your server correctly and if you saved the page with a file extension of .php and not .html, it will convert this tag to proper HTML for display in the browser, which ultimately renders it as “Hello Visitor!” Of course, you could have performed this task anyway, just using HTML. PHP’s true value lies in its more advanced functionality, which can be used to create interactivity. PHP, like ASP.NET, is often combined with databases. PHP can be used to communicate with a database, gather input or data from a user, and create an interactive experience from that. Of course, acquiring the knowledge to do this takes some practice and study, but PHP is a popular technology for this sort of interaction. Should you want to pursue PHP, we’ve provided a few resources below.

Note that PHP is a server-side technology. If you want .php files to work as designed on a web server, PHP must be installed on that server. Keep this in mind when you choose a web host for your website. Many hosts, but certainly not all, support PHP. Most will clearly state whether or not they support PHP.

No comments:

Post a Comment