PHP

 
 
PHP (= Hypertext Preprocessor) is an HTML-embedded server-side scripting language.

PHP is distributed at no charge for commercial or non-commercial use. For more information read the LICENSE information.

More information about PHP can be found at: http://www.php.net

PHP manuals can be found at:
http://www.php.net/manual/en/
http://devzone.zend.com/manual/

The latest PHP version can be downloaded from: http://www.php.net/downloads.php

rss feed






Install PEAR available in PHP 4



Information
PEAR (= PHP Extension and Application Repository) is a framework and distribution system for reusable PHP components.

More information about PEAR can be found at: http://pear.php.net

Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
PHP 4


Procedure
  1. After you installed PHP, see quick guide "Installing PHP4 on Apache 2",
    PEAR is already available. See C:\Tools\php-4.3.7-Win32\PEAR. You just need to set it up.

  2. Go to the unzipped php directory:
    E.g.: C:\Tools\php-4.3.7-Win32

  3. Open a dos window and run the PEAR installer, type:

    C:\Tools\php-4.3.7-Win32>go-pear.bat
    Welcome to go-pear!

    Go-pear will install the 'pear' command and all the files needed by
    it. This command is your tool for PEAR installation and maintenance.

    Go-pear also lets you download and install the PEAR packages bundled
    with PHP: DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit-0.6.2.

    If you wish to abort, press Control-C now, or press Enter to continue:
    [Enter]

    HTTP proxy (http://user:[email protected]:port), or Enter for none::[Enter]

    Below is a suggested file layout for your new PEAR installation. To
    change individual locations, type the number in front of the
    directory. Type 'all' to change all of them or simply press Enter to accept these locations.

     1. Installation prefix          : C:\Tools\php-4.3.7-Win32
     2. Binaries directory           : $prefix
     3. PHP code directory ($php_dir): $prefix\pear
     4. Documentation base directory : $php_dir\docs
     5. Data base directory          : $php_dir\data
     6. Tests base directory         : $php_dir\tests
     7. php.exe path                 : C:\Tools\php-4.3.7-Win32\cli\php.exe

    1-7, 'all' or Enter to continue:
    [Enter]

    The following PEAR packages are bundled with PHP: DB, Net_Socket, Net_SMTP,
    Mail, XML_Parser, PHPUnit-0.6.2.
    Would you like to install these as well? [Y/n] :
    [Enter]

    Loading zlib: ok
    Using local package: PEAR.............ok
    Using local package: Archive_Tar......ok
    Using local package: Console_Getopt....ok
    Using local package: XML_RPC..........ok
    Bootstrapping: PEAR...................(local) ok
    Bootstrapping: Archive_Tar............(local) ok
    Bootstrapping: Console_Getopt.........(local) ok
    Using local package: DB...............ok
    Using local package: Net_Socket.......ok
    Using local package: Net_SMTP.........ok
    Using local package: Mail.............ok
    Using local package: XML_Parser.......ok
    Downloading package: PHPUnit-0.6.2....ok
    Extracting installer..................ok
    install ok: PEAR 1.3.1
    install ok: Archive_Tar 1.1
    install ok: Console_Getopt 1.2
    install ok: XML_RPC 1.1.0
    install ok: DB 1.6.1
    install ok: Net_Socket 1.0.1
    install ok: Net_SMTP 1.2.5
    install ok: Mail 1.1.2
    install ok: XML_Parser 1.0.1
    install ok: PHPUnit 0.6.2

    ******************************************************************************
    WARNING! The include_path defined in the currently used php.ini does not
    contain the PEAR PHP directory you just specified:
    <C:\Tools\php-4.3.7-Win32\pear>
    If the specified directory is also not in the include_path used by
    your scripts, you will have problems getting any PEAR packages working.

    Would you like to alter php.ini <C:\WINDOWS\php.ini>? [Y/n] :
    [Enter]

    php.ini <C:\WINDOWS\php.ini> include_path updated.

    Current include path           : .;c:\php4\pear
    Configured directory           : C:\Tools\php-4.3.7-Win32\pear
    Currently used php.ini (guess) : C:\WINDOWS\php.ini
    Press Enter to continue:
    [Enter]

    The 'pear' command is now at your service at C:\Tools\php-4.3.7-Win32\pear.bat

    ** The 'pear' command is not currently in your PATH, so you need to
    ** use 'C:\Tools\php-4.3.7-Win32\pear.bat' until you have added
    ** 'C:\Tools\php-4.3.7-Win32' to your PATH environment variable.

    Run it without parameters to see the available actions, try 'pear list'
    to see what packages are installed, or 'pear help' for help.

    For more information about PEAR, see:

      http://pear.php.net/faq.php
      http://cvs.php.net/co.php/pearweb/doc/pear_package_manager.txt?p=1
      http://pear.php.net/manual/

    Thanks for using go-pear!

    * WINDOWS ENVIRONMENT VARIABLES *
    For convenience, a REG file is available under C:\Tools\php-4.3.7-Win32\PEAR_ENV
    .reg .
    This file creates ENV variables for the current user.

    Double-click this file to add it to the current user registry.

    Press a key to continue. . .
    [Enter]

  4. Add the php-4.3.7-Win32 directory to your "Path" system environment variable.
    e.g.: PATH=%PATH%;C:\Tools\php-4.3.7-Win32



  5. Modify file C:\Tools\php-4.3.7-Win32\PEAR_ENV.reg.
    This file contains an error.

    REGEDIT4
    [HKEY_CURRENT_USER\Environment]
    "PHP_PEAR_SYSCONF_DIR"="C:\\Tools\\php-4.3.7-Win32"
    "PHP_PEAR_INSTALL_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear"
    "PHP_PEAR_DOC_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear\\docs"
    "PHP_PEAR_BIN_DIR"="C:\\Tools\\php-4.3.7-Win32"
    "PHP_PEAR_DATA_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear\\data"
    "PHP_PEAR_PHP_BIN"="C:\\Tools\\php-4.3.7-Win32\\cli\\php.exe"
    "PHP_PEAR_TEST_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear\\tests"


    Change this into:

    REGEDIT4

    [HKEY_CURRENT_USER\Environment]
    "PHP_PEAR_SYSCONF_DIR"="C:\\Tools\\php-4.3.7-Win32"
    "PHP_PEAR_INSTALL_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear"
    "PHP_PEAR_DOC_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear\\docs"
    "PHP_PEAR_BIN_DIR"="C:\\Tools\\php-4.3.7-Win32"
    "PHP_PEAR_DATA_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear\\data"
    "PHP_PEAR_PHP_BIN"="C:\\Tools\\php-4.3.7-Win32\\cli\\php.exe"
    "PHP_PEAR_TEST_DIR"="C:\\Tools\\php-4.3.7-Win32\\pear\\tests"


    Note: Add an empty line between REGEDIT4 and [HKEY_CURRENT_USER\Environment]

    After you have changed this file, double click the file.
    Seven USER environment variables will be created.

  6. Open a dos window and type: pear

    You should see:

    Usage: pear [options] command [command-options] <parameters>
    Type "pear help options" to list all options.
    Type "pear help <command>" to get the help for the specified command.


    Commands Description
    build Build an Extension From C Source
    bundle Unpacks a Pecl Package
    clear-cache Clear XML-RPC Cache
    config-get Show One Setting
    config-help Show Information About Setting
    config-set Change Setting
    config-show Show All Settings
    cvsdiff Run a "cvs diff" for all files in a package
    cvstag Set CVS Release Tag
    download Download Package
    download-all Downloads each available package from master_server
    info Display information about a package
    install Install Package
    list List Installed Packages
    list-all List All Packages
    list-upgrades List Available Upgrades
    login Connects and authenticates to remote server
    logout Logs out from the remote server
    makerpm Builds an RPM spec file from a PEAR package
    package Build Package
    package-dependencies Show package dependencies
    package-validate Validate Package Consistency
    remote-info Information About Remote Packages
    remote-list List Remote Packages
    run-tests Run Regression Tests
    search Search remote package database
    shell-test Shell Script Test
    sign Sign a package distribution file
    uninstall Un-install Package
    upgrade Upgrade Package
    upgrade-all Upgrade All Packages

  7. To check which PEAR packages have been installed, open a dos window and type:

    pear list

    You should see:

    INSTALLED PACKAGES:
    ===================
    PACKAGE         VERSION   STATE
    Archive_Tar     1.1       stable
    Console_Getopt  1.2       stable
    DB              1.6.1     stable
    Mail            1.1.2     stable
    Net_SMTP        1.2.5     stable
    Net_Socket      1.0.1     stable
    PEAR            1.3.1     stable
    PHPUnit         0.6.2     stable
    XML_Parser      1.0.1     stable
    XML_RPC         1.1.0     stable


  8. Modify C:\Windows\php.ini

    ;***** Added by go-pear
    ;include_path=".;C:\Tools\php-4.3.7-Win32\pear"
    ;*****


    Change this into:

    ;***** Added by go-pear
    include_path="C:/Tools/php-4.3.7-Win32/PEAR"
    ;*****

    Note: Remove .; and change backslash into forward slash.

  9. Restart Apache.