www.digitaldaze.com
mod_php4 Apache Module

The best way to use PHP with your virtual server is as an Apache Module. Alternately, the PHP CGI is available for those who need command-line access to PHP.

NOTE: Any version of PHP prior to 4.2.2 has a known security vulnerability which can compromise your virtual server. If you are using any version prior to PHP4.2.2, we strongly encourage you to upgrade to the current version.

PHP4

To install mod_php4 on your virtual server, connect to your server via SSH or Telnet and do the following:

  1. Install the PHP4 Apache module by running the following command:

        % vinstall php4-dso

    When you run the vinstall command, you will be given the option to select which extensions you want to use. In order to not waste memory on your virtual server, we recommend that you only select extensions you will actually be using. If you find you need to add or remove extensions at a later time, you can manually edit the php.ini file, or use the vinstall command to change the active extensions.

  2. The installation process should configure your web server to dynamically load the PHP4 Apache module. Check to make sure the following line is in your web server configuration file (~/www/conf/httpd.conf).

        LoadModule  php4_module  modules/mod_php4-4.4.1.so

    NOTE: In versions of PHP4.2.2 and later, one of the default settings has been changed. This has been found to affect several commonly used scripts, including TWIG. If you are using TWIG or are having trouble with scripts that worked without problems prior to upgrading to version 4.2.2, create or edit the file named php.ini in the ~/usr/local/lib/ directory of your virtual server. The php.ini file needs to contain at least this line:

        register_globals = On

  3. Check to see that the following additions and modifications have been made to your web server configuration file (~/www/conf/httpd.conf). If the vinstall script failed to make the appropriate changes, you will need to do so yourself.

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

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

          AddType application/x-httpd-php .php .php3 .php4 .phtml
          AddType application/x-httpd-php-source .phps
  4. Restart your Web Server by running the restart_apache command.

  5. To test your PHP installation, try creating the following ~/www/htdocs/test.php4 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.

 

[Legal Notice]
http://www.digitaldaze.com