Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


PHP - Page 18

November 11, 2002

PHP: Hypertext Preprocessor (PHP) is a server-side scripting language that can be embedded in HTML pages. It has been around for a few years now, but has undergone significant changes over that time. PHP borrows much of its syntax from Perl. When it was first created, it was intended to provide a more trimmed-down, easier-to-write, HTML-embeddable alternative to Perl, a task at which it seems to have succeeded. PHP is free, cross-platform, open source software; it integrates with all major web servers on all major operating systems.

Advantages

  • It's open source and freely available from http://www.php.net/.
  • It's cross-platform.
  • It has a very active user community.
  • It's seen as having a light footprint and not being processor-intensive.

Drawbacks

  • It's relatively difficult to expand the language to add non-standard functionality that not handled by its built-in functions.
  • PHP's extensibility is limited compared to say, Java, ASP, and COM (although new libraries pop up with every release)
  • The function syntax to connect to each different brand of database is slightly different. Compare this to Java, which has a generic JDBC interface to connect to databases or ASP, which has its ADO abstraction layer.

XML Support

PHP has 4 extensions for performing XML tasks. Perhaps the most widely used of these are the XML parser functions – these use the Expat library, a SAX-based parser. Although it can parse XML, it does not perform any validation of the document. It supports 3 character encodings, namely US-ASCII, ISO-8859-1 and UTF-8, but does not support UTF-16. As you already know, with a SAX parser you define event handlers for XML events: as the parser works through the XML document it will call these handlers as and when events occur. The Expat library can be found at http://www.jclark.com/xml/.

PHP can also do DOM parsing of the XML document, but at the moment this extension is considered experimental. The extension is being overhauled for PHP 4.3.0 and the behaviour of many of the functions may change, so when using this extension it is best to avoid any non-object-oriented function (a full list of deprecated functions is available with the documentation). The extension uses the Gnome XML library, which you can find at http://www.xmlsoft.org/.

The PHP extension that provides XSLT support currently supports the Sablotron library. This extension has recently been rewritten in order to provide support for other libraries like Xalan and libxslt. Sablotron can be found at http://www.gingerall.com/.

For our PHP examples here to work properly, you need to make sure you have the XSLT and XML DOM extensions installed. Don't worry, as they are included in the PHP package downloadable from http://www.php.net/do_download.php?download_ file=php-4.2.2-Win32.zip (see the InstallPHP.txt file in the code download for more instructions on installing this properly).

Finally, PHP also contains RPC support through the XMLRPC extension, although this is also considered experimental.


Server Used for Examples

For the examples in this chapter, we used Apache 1.3.26 and PHP 4.2.2 on Windows 2000 Professional.

Server-Side Languages - Page 17
Practical XML for the Web
JSP - Page 19


Up to => Home / Authoring / Languages / XML / PracticalXML




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers