The mod_php3 Apache Module

NOTE: PHP is provided as a legacy feature on FreeBSD Virtual Private Servers. The latest version of PHP is PHP4. Unless you absolutely require PHP3, we strongly recommend using the latest version of PHP.

Installation

To install mod_php3, connect to your Virtual Private Server via SSH or Telnet and do the following.

  1. Select which PHP module you want to use from the list of available modules below.

    No database support
    mod_php3-3.0.18-module.so
    mod_php3-3.0.18-module-imap.so
    mod_php3-3.0.18-module-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-mcrypt-freetype-gd.so
    mod_php3-3.0.18-module-mcrypt-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-mcrypt-ftp-imap.so
    
    mSQL database support
    mod_php3-3.0.18-module-msql.so
    mod_php3-3.0.18-module-msql-imap.so
    mod_php3-3.0.18-module-msql-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-msql-mcrypt-freetype-.so
    mod_php3-3.0.18-module-msql-mcrypt-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-msql-mcrypt-ftp-imap.so
    
    MySQL database support
    mod_php3-3.0.18-module-mysql.so
    mod_php3-3.0.18-module-mysql-imap.so
    mod_php3-3.0.18-module-mysql-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-mysql-mcrypt-freetype-gd.so
    mod_php3-3.0.18-module-mysql-mcrypt-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-mysql-mcrypt-ftp-imap.so
    
    PostgreSQL database support
    mod_php3-3.0.18-module-pgsql.so
    mod_php3-3.0.18-module-pgsql-imap.so
    mod_php3-3.0.18-module-pgsql-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-pgsql-mcrypt-freetype-gd.so
    mod_php3-3.0.18-module-pgsql-mcrypt-ftp-imap-freetype-gd.so
    mod_php3-3.0.18-module-pgsql-mcrypt-ftp-imap.so

    In order to optimize performance on your Virtual Private Server, it is a good idea to select a module with only the features you need.

  2. Check to see if the module you want exists in your ~/www/modules/ directory:

    % cd ~/www/modules
    % ls

    If you don't see the module you want listed there, you can link it in from the system apache modules directory using the following command:

    % ln /usr/local/apache/1.3/modules/module_name ~/www/modules/
  3. Add the following line to the top of your web server configuration file (~/www/conf/httpd.conf) to dynamically load the PHP3 Apache module. Substitute the file name of the Apache module you want to install for module_name.

    LoadModule  php3_module  modules/FILE-NAME
  4. Make the following additions and modifications to your web server configuration file (~/www/conf/httpd.conf).

    1. Modify the DirectoryIndex line so that index.php3 files will be included as directory indices.

      DirectoryIndex index.php3 index.cgi index.html index.htm
    2. Add the following lines so that all files with .php3 and .phtml extensions will be redirected to the PHP3 Apache module.

      AddType application/x-httpd-php3 .php3
      AddType application/x-httpd-php3 .phtml
  5. To test your PHP installation, try creating the following ~/www/htdocs/test.php3 document and viewing it in your web browser.

    <HTML>
    <BODY>
    <?php
      phpinfo();
    ?>
    </BODY>
    </HTML>

    The phpinfo() function reports the version number, as well as the features that are compiled into PHP