Home > Articles

  • Print
  • + Share This
From the author of

PHP Scripting

As in your setup for Java servlets, to use PHP for your server-side development you have to set up server software to support this environment. We have chosen to describe an environment that consists of Apache web server with the PHP processor module installed.

Setting Up a PHP Environment

The following software is required:

Download and install the software in the order listed. Apache uses a straightforward Windows installation program. Managing the web server is accomplished via a Windows program group. To start the server, select Start, Programs, Apache httpd Server, Start Apache In Console. To test your installation, enter the URL http://localhost, and you should see the Apache welcome page.

When you've downloaded the PHP binary, uncompress the file into an installation directory. Then follow the directions in the file install.txt:

  1. With Apache stopped, edit the httpd.conf file, adding these lines:

    LoadModule php4_module <phpinstalldir>/sapi/php4apache.dll
    AddType application/x-httpd-php .php4
    ScriptAlias /php4/ "<phpinstalldir>"
    Action application/x-httpd-php4 "/php4/php.exe"
    AddType application/x-httpd-php4 .php
  2. Uncompress the download file to an installation directory and move the file php4ts.dll to windows/system(32), overwriting any older file.

  3. Copy the php.ini-dist file to your sysroot (directory where you installed Windows); rename it to php.ini.

  4. Restart the Apache server.

Simple Example

Now that you have your web server configured to support PHP, here's a simple example to test your configuration:

 <head><title>Hello World</title></head>
 <body><?php echo "Hello World! Written from PHP<p>"; ?></body>

To put a VoiceXML spin on this example, examine the following:

<?php header("Content-Type: text/xml");?>
<?xml version="1.0"?>
<vxml version="1.0">

   <?php echo "Hello Voice World! Spoken from PHP";?>

Server-side script source is contained within the <?...?> tags. Again, we set the content type to reflect what the VoiceXML gateway is expecting. Otherwise, the only changes are the voice-specific tags.

  • + Share This
  • 🔖 Save To Your Account