How to Install a PHP Package

PHP extensions (or packages) are distributed through PEAR (PHP Extension and Application Repository). These extensions are reusable code and applications written for PHP by third party developers. The pear application allows you to install these extensions for PHP from your operating system's command line. Once installed, these packages will allow you to extend your code in ways such as access the file system, read and write PDF files and add encryption, as well as many others.

Things You'll Need

  • PHP
  • PEAR (PHP Extension and Application Repository)
  • Lynx text based web browser
Show More

Instructions

  1. Installing PEAR on Windows

    • 1

      Open the Command Prompt application. The Command Prompt is found under "All Programs -> Accessories."

    • 2

      Type the command "c:\php\go-pear.bat" into the command line.
      This batch file may be located elsewhere if you have chosen a non-default setup for PHP.

    • 3

      Answer the configuration questions.

    • 4

      Open a browser window and type "http://pear.php.net/go-pear" into the address bar.

    • 5

      Save the output from the browser window into a text file called "go-pear.php". You can save it as a text file by using Windows Notepad found under "All Programs -> Accessories."

    • 6

      Run the command php go-pear.php in the Command Prompt Window.

    • 7

      Check that the installation was configured correctly by typing "pear" in the Command Prompt Window.

    Installing PEAR on Linux/Unix

    • 8

      Install the Lynx command line browser. This browser can be installed via the operating system's package manager or by downloading it from the Lynx website.

    • 9

      Open a terminal window. The terminal window will be found under the "System Tools" or "Utilities" sub menu in your operating system's main "Applications" menu.

    • 10

      Type the following command into the terminal window:
      lynx -source http://pear.php.net/go-pear | php

    • 11

      Answer the configuration questions.

    • 12

      Check that the installation was configured correctly by typing "pear" in the terminal window.

    Installing PEAR Packages

    • 13

      Find the package that you want to install from the list on the PEAR website.

    • 14

      Write down the exact name of the package.

    • 15

      Open the Command Prompt (Windows) or terminal window (Linux/Unix).

    • 16

      Type the following command on the command line:
      pear install <package name>.
      Replace <package name> with the name of the package you want to install.

    • 17

      Close the command prompt or terminal window.

Related Searches:

References

Resources

Comments

You May Also Like

Related Ads

Featured