Using PHP4 on Porsche (CISC474, 06S)

(IN DEVELOPMENT—NOT YET FULLY TESTED)

 

First: Get a private copy of Apache 2.0 running

I've put directions for getting a private copy of Apache 2.0 running in topics/apache/runningApache2.0.onPorsche.html

You'll need to either stop Tomcat first, or run Apache on a different port than Tomcat. If you choose a port in the port mapping table, you'll need to actually run the Apache process on the "car" machine that the port is mapped to, rather than on porsche directly.

Do all of that first.

Then: Configure your local copy of Apache to use PHP4

Step 1: Add directives to your httpd.conf file to load PHP4

At the end of your httpd.conf file, add the following:

LoadModule php4_module /usr/local/software/net/apache2/modules/libphp4.so
# Tell Apache to parse certain extensions as PHP. For example,
# let's have Apache parse the .php extension as PHP. You could
# have any extension(s) parse as PHP by simply adding more, with
# each separated by a space. We'll add .phtml to demonstrate.
AddType application/x-httpd-php .php .phtml
# It's also common to setup the .phps extension to show highlighted PHP
# source, this can be done with:
       
AddType application/x-httpd-php-source .phps
     

Step 2: Test it with the following code

If it works, you should be able to put the following code in two different files, one called test.php, and the other called test.phps. The test.php file should echo simply "Hi, I'm a PHP script!", while the test.phps version shows the code as formatted below (with colors).

<html>
   <head>
       <title>Example</title>
   </head>
   <body>

       <?php
       
echo "Hi, I'm a PHP script!";
       
?>

   </body>
</html>

Optional: Create a local directory for PHP and a local php.ini file
(I haven't tried this yet, and don't know if it works)

PHP also has a configuration file called php.ini. According to the PHP documentation about the configuration file , the location of a personal copy of this file can be specified with an environment variable, PHPRC, like this:

Using a database from PHP

I haven't yet tested whether this installation of PHP is configured to be able to connect to MySQL or not. If one of you sees this notice and wants to test it for some credit towards the course, contact me first.

More information

Last modified: 2006-03-27 3:50 PM


Valid XHTML 1.1 Valid CSS!