HOME | SITEMAP | SUPPORT | FAQs
DOMAIN MANAGE/BACKROOM | BILLING
4Domains Web Hosting and Domain Registration
Account Login   WebMail   Live Chat

Web Hosting

Domain Names

Domain Auction

Solutions

Home > Support > Virtual > Php > 4

PHP4

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

There are two different ways to install PHP4 on a Virtual Server. The best way is to install it as a Dynamic Module.

PHP can also be installed as a CGI. The PHP CGI is a free-standing PHP interpreter. While this makes PHP available through the command line, it is less efficient than the PHP Apache Module.

Dynamic Module Installation

Connect to your Virtual Server via Telnet or SSH and do the following:

  1. Upgrade Your Virtual Server Apache (if you aren't already running Apache 1.3).

  2. Install the PHP4 dynamic modules on your Virtual Server.

    % vinstall php4-dso
    

    NOTE: When you run the vinstall command, you will be given the option to select which extensions you would like to enable in PHP. This is displayed in a Windows-like display. Use arrow keys to move through the menu and the [Space Bar] to select which modules to enable. You can use [TAB] to cycle to the "OK" button. Please note with some telnet programs (such as Microsoft Windows' Telnet) the arrow keys do not correctly map to your terminal. Try an SSH program such as PuTTY which is free and offer many features over standard Telnet programs.

    In order to not waste memory on your Virtual Private Server, we recomend 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 ~/usr/local/lib/php.ini file, or use the vinstall command to change the active extensions.

  3. 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.3.0.so
    
  4. 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
      
  5. Restart (restart_apache) your webserver.
  6. To verify that PHP is installed correctly create a page with the following contents:
    <HTML>
    <BODY>
    <?php
      phpinfo();
    ?>
    </BODY>
    </HTML>
    

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

CGI Redirect Installation

The PHP CGI can be installed much the same as the Apache module version.

% vinstall php4-cgi
Due to security issues the PHP4 CGI is installed in ~/usr/local/bin/php. To link this into your cgi-bin (and to make it avalible to webpages) do the following:
% cd ~/www/cgi-bin
% ln ../../../bin/php.cgi php

  • 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 (restart_apache) your webserver.
    4. You can test this installation with the same phpinfo() as above.

    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 Private Server. The php.ini file needs to contain at least this line:

    register_globals = On

  • Why Us? | About | Contact Us
    Knowledge Base | Support Request
    Expired Domains | Domain Name Auctions | VPS Directory | DNS Tools
    Hosting Terms | Domain Terms | Privacy Policy
    Copyright © 2008 - 4Domains.com, Inc.


    web hostinghostingdomaindomain namedomain namescheap web hostingecommerce website designdomain registration

    Web Monitoring | SEO Technology | Hacker Scanner | DNS Tools | Online Backup