Username / Password :   
LinuxDig.Com Technology Articles
Your Linux News and Resource Site

The Power and The Promise of PHP: Article I
Author: | Monday November 25, 2002

PHP Hypertext Preprocessor is an HTML - embedded scripting language with much of its syntax borrowed from C, Java and Perl. Intimidating as it may seem, PHP does not reflect the difficulty or knowledge needed as with many of these languages. This is the first article in a series of PHP articles which will only be found on Linuxdig.com


How does it work?

PHP commingles with your HTML documents on the server side before the page is delivered to the client. Much like perl or any other CGI application PHP executes the document before delivery. This gives the developer a system to create applications such as page verification, session related activities, dynamic content and so forth. PHP also includes within the system the ability to communicate with a wide range of databases from Mysql, Postgres and any number of ODBC databases as well.



PHP contains a configuration file on the server which describes how PHP will react within its environment. This configuration is documented, extensive and extremely flexible which allows for a number of modifications from page display, security, POST/GET requests and so on.



When a client requests a document, for example mydocument.php, your webserver will activate PHP and begin the process of execution. At this point PHP breaks the document apart and finds the PHP commands within the HTML and generates the outgoing page. During this time, PHP also includes any POST variables that may have been submitted by the client webpage through a form or standard url. These variables are available at time of POSTING as a normal variable within PHP.



For Instance : http://www.mywebsite.com?this=25



Within your PHP code the variable “this” now becomes an active variable which can be addressed as $this. From this point you can calculate, add it to a variable or decide to load another page and so on.



The Promise

The promise of PHP is its ease of use for the web. Many other CGI-Applications or Scripting languages require some sort of proxy to allow interaction between the web and the applications themselves. PHP was developed with the Web in mind and naturally integrates itself with your web server. This integration allows for flexibility and faster development times.



The language of PHP is fairly straight forward and lacks the complexities of syntax that many other languages seem to adhere themselves to. PHP offers a wide array of functions that are commonly found in other languages as well as Web Friendly functions. The “Web Friendly Functions” are those functions which are routinely needed for the web environment which most other applications would require you to develop but which are ingrained in to PHP’s core function set.



Some examples of these Web Friendly Functions are :






Communication with E-Commerce Credit Card Clearing Houses
Url Modification / Encoding
FTP downloads / Uploads
HTTP Upload / Download
WebPage Downloading
* Some of these examples are built within general functions that allow this type of activity.



Documentation and Help

PHP is well documented and there is plenty of help for you on the Net. There is also a number of books that have been written. At the end of this document I will include a few resources for you.



Cross Platform / Open Source

PHP is also a cross platform language which supports a number of Operating Systems from Windows 98/XP/NT/2000, Linux and variations of Unix. PHP is an Open Source language that is constantly evolving and producing better versions whith each release. PHP is a secure environment as long as you follow some of the instructions the developers provide. As of this writing, I only know of one possible exploit to PHP that was found and it was repaired quickly. The exploit was a probable one and to my knowledge was not used as an attack method.



Last Thoughts

For those of you who are concerned, their is an compiler/optimizer which can increase the performance of PHP up to 50% faster then in its native environment. Though for 99% of us, this is not needed. The good thing about the compiler is that you can secure your scripted code into binary form which would not allow anyone to view your code if per say your system were hijacked or if you did not want root users the ability to view it.



For the Microsoft fanatics out their, an ASP to PHP converter is available which will convert your VB Script apps to PHP. On this subject, PHP is a much better choice then VB Script because it is an open environment which can run on most Operating Systems without the need to purchase Run-Time executables.



PHP can also be utilized as your Scripting Language of choice for all your non web related needs. You can use it for log analysis, system cleanup, text parsing and so forth. Your needs as an administrator will be met with PHP.



Help

http://www.php.net : PHP Main Site

http://www.phpbuilder.com : A Great Site for Help and php scripts.



PHP in 24 Hours : This book is even to this day, 2.5 years later a book I use as reference. “PHP in 24 Hours” is book for beginners, it is well written, follows a very logical educational course and again works well as reference.


Author
HumanX
LinuxDig.Com
humanx@linuxdig.com


"Your Linux News and Resource Site"
©2003 LinuxDig.Com. LinuxDig.Com, LinuxDig and Penguin Initiative are copyrights of LinuxDig.com.
Site Hosted By Digital Environments, Inc. This Website was Created with DE-Web Version 1.9.7.4,
The Fast, Web Based - Website Design Tool, Groupware and Web Hosting System by Digital Environments, Inc.
Groupware:Project Management, Sales Tracking, Web Site Design and News / Blogger all in one package.