![]() |
Web Conference 2005Writing PHP for ITS/ASET Web servicesThe Basic 'What's' of PHP Programming |
![]() |
<- Back - Tips on Taking This Course | | | Up | | | Penn State Specifics - Next -> |
What is PHP? [top]
PHP stands for PHP hypertext preprocessor (what we in the industry call a recursive acronym). It originally stood for Personal Home Page.
PHP is a Programming Language
Unlike Hyper-Text Markup Language (HTML) which is used to mark up or describe the presentation of text, PHP is a programming language capable of instructing computers to perform various tasks. The syntax and semantics are similar to the C and Perl programming languages and it may be embedded into HTML in a similar fashion as ASP or Coldfusion.
How is PHP useful?
PHP is a programming language chiefly intended for the Web as a server-side dynamic content generator. It is usually ran as an embedded scripting language, but can also be run as CGI.
Who is responsible for PHP?
The PHP language has been written and is still being revised by the PHP Group. The main program that interprets the PHP language on Web servers is the Zend engine. The main site for PHP is www.php.net.
Learning more about PHP
In addition to this site, you may want to try out the php.net tutorial or the online PHP manual.
Static vs Dynamic content [top]
Static Content - Plain Web pages (.html) are said to be static content; in other words, content that does not change from the time it is written to the time it is viewed. Successive views also see no change.
Dynamic Content, on the other hand, has the ability to change, based on time of day, user interaction or feedback from external data sources. When viewing a Web page, program such as PHP or JavaScript may run or execute, producing content automatically; that is to say, dynamically, for the user to see. Some static pages may contain dynamic components such as a counter or Server Side Include (SSI) to print the date.
Server-side vs Client-side dynamic content [top]
Server-side dynamic content is Web content that changes; i.e., runs, on the server.
Examples of this include PHP, CGI, ASP, ColdFusion and Java servlets.
Client-side dynamic content, on the other hand, is Web content that changes on the client end, meaning it runs within the browser.
Examples of this include Flash, JavaScript, ActiveX and Java applets.
Server-Side | Client-Side | |
---|---|---|
Is ran | First - On the server | Second - After it is downloaded to the browser |
Portability | Runs in all browsers | Requires browsers with applicable software and additional cross-browser testing |
Computing load is | Centralized | Distributed |
Form field checking is | More Secure - Form fields may be checked for security bypasses | Faster - Is done first and without network latency. |
Best of both worlds - Server-side and client-side dynamic content may be integrated together to take advantage of both types.
For example, a Web form may use JavaScript to check for missing or invalid field data and alert the user before it is sent to the server.
When the data is submitted, a server-side program such as PHP may perform a second check on the data to verify the user didn't try to bypass a security restriction or corrupt the database with invalid data. It is also useful to support browsers that do not have JavaScript or have it disabled.
The downside to this approach is that it requires more code to be written and managed.
Embedded vs CGI vs Containers [top]
Embedded into HTML
When a language like PHP can be placed within static HTML content, it is considered embedded in HTML. Embedded dynamic content is processed directly by the Web server program (process). Examples include Active Server Pages (ASP) in Microsoft's Internet Information Server (IIS) and PHP in Apache's mod_php module. The PHP dynamic content application engine php.scripts.psu.edu uses the Apache HTTPD server and mod_php to process PHP content embedded in HTML.
CGI
Common Gateway Interface (CGI) is a method to call another program on the Web server computer in order to process a dynamic content page. The PHP language may also be run as CGI.
Application Containers
Finally, some server-side dynamic content can be ran in containers; that is, a secondary program that runs along with the Web server. An example of this is Java servlets and JSP in Apache Tomcat. Sun Microsystems Java System Active Server Pages (ASP) (formerly Sun ONE ASP and ChiliSoft ASP) also runs ASP within a container environment.
Common Gateway Interface (CGI) is really two different things.
A method by which Web browsers and Web servers communicate form data.
A method by which Web servers run helper programs to generate the server delivered content.
For more information on CGI, you may view my last year's Web Conference presentation on Perl and CGI.
<- Back - Tips on Taking This Course | | | Up | | | Penn State Specifics - Next -> |
If you have any questions, feel free to ask me. Content by: Jeff D'Angelo <jcd@psu.edu> © 2005 Last update on: Mon Jun 13, 2005, 7:59:01 AM |
![]() |