AlpineWeb Home
Search: For:   ~ Advanced Search  
  Support Home     Documentation     Knowledgebase     Help Desk     Blog 
Support Home > VPS > FreeBSD > Administration > vinstall > PHP4 > Sunday, July 20, 2008

The PHP4 CGI


PHP There are two different ways to install PHP4 on a Virtual Private Server. The best way is to install the mod_php4 Apache Module. It can also be installed as a CGI to which PHP4 files are redirected by your web server.

Installation

To install the PHP4 CGI, connect to your Virtual Private Server via SSH prompt, as root and do the following.
  1. Install the PHP4 CGI by running the following command:
    % vinstall php4-cgi
    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 Private 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.
    NOTE: Any version prior to PHP4.2.2 has a known security vulnerability which can compromise your Virtual Private Server. If you are using a version of PHP prior to 4.2.2, we strongly encourage you to upgrade to the most recent version.
  2. Due to Security Issues the PHP4 CGI is installed at ~/usr/local/bin/php. Do the following to link the PHP4 CGI into your ~/www/cgi-bin directory.
    % cd ~/www/cgi-bin
    % ln ../../../bin/php.cgi php
  3. Make the following additions and modifications to your web server configuration file (/www/conf/httpd.conf).
    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 CGI executable.
      Action     php4-script /cgi-bin/php
      AddHandler php4-script .php .php3 .php4 .phtml
    3. Restart your Web Server by running the restart_apache command.
  4. 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.

Technical Support
° Getting Started Guides
  FreeBSD
° Basic Hosting Help
° Signature Hosting Help
° VPS v1 Help
° VPS v2/3 Help
° MPS v2/3 Help
  Linux
° VPS v3 Help
° MPS v3 Help
  SaaS
° Sugar CRM
  DNS
° Domain Name Service
° Domain Registration
° Help Desk
° Knowledgebase
° Support Policies
° Disclaimer

° AlpineWeb Home
° Compare Hosting Plans
° Network Topology

° Rates & Fees
° Order Center




  Home | Site Map | Customer Backroom Copyright  ©  1997-2008  AlpineWeb Design