14.8.Deploying PHP Applications

The PHP server extension allows Virtuoso to execute PHP (v4) pages stored in the file system or in Virtuoso's WebDAV repository. PHP pages run inside the Virtuoso process.

Figure14.53.The HTTP PHP handler

The HTTP PHP handler

The VSE __http_handler_php() has been implemented so that the file extension '.php' is recognized by Virtuoso to switch between 'normal' mode and extension processing for PHP mode in the HTTP/WebDAV services.

PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-purpose scripting language that is suited for Web-based development. Here is an example of a simple PHP page:

Example14.64.PHP introductory example


        echo "Hi, I'm a PHP script!";


Notice how this is similar to VSP script, and different from a script written in other languages like Perl or C -- instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode".