Category Archives: Uncategorized - Page 3

Install PEAR and PEAR packages

This article is for those who don’t have PEAR framework installed with WAMP or XAMPP servers and want to install it, especially to send email using either WAMP Server 2.0c or older versions.

While reading and following this article, replace the Apache’s and PHP’s version numbers with what your system have.

(Skip this paragraph if you don’t want to know about PEAR and want to go directly to the installation steps.) From PEAR’s page: “PEAR is a framework and distribution system for reusable PHP components”. PEAR has many useful libraries to make various web operations easy. Authentication, Date-Time, Encryption, File Formats and Compression, Images, eMail, Math, Number, Captcha, Validation, Streams, Web Services are few of the categories for which lots of packages are available to use freely. However there are extensive information about them but there is no useful documentation is available on their website about installing PEAR. PEAR is not bundled with older WAMP Server versions; so here are the steps to install PEAR on localhost/WAMP Server. It should also work with XAMPP.

  1. Create a backup of copy of the “index.php” file of your WAMP Server located at “C:\wamp\www” folder, PEAR installer will replace this file.
  2. Open php.ini file (“Taskbar WAMP Icon -> PHP -> php.ini” OR “C:\wamp\bin\apache\Apache2.2.17\bin\php.ini”), search for “error_reporting” setting and set it to “E_ALL & ~E_DEPRECATED”.
  3. Enable “php_sockets” and “php_openssl” extensions of PHP:
  4. Enable “ssl_module” module of Apache:
  5. Create a folder named “pear” inside “C:\wamp\bin\php\php5.2.6” folder.
  6. Click this link http://pear.php.net/go-pear; a PHP Script file will be shown.
  7. Press Ctrl + S to save the file. Give “go-pear.php” name to it and save it in the “C:\wamp\www” folder.
  8. Click this link http://localhost/go-pear.php to start setup of PEAR.
  9. In the page, click on “Next>>”, “Packages” page will be shown.
  10. In “Configurations” section, set “Installation Prefix ($prefix)” to “C:\wamp\bin\php\php5.2.6\pear”.
  11. You may set “C:\wamp\bin\php\php5.2.6” for the 11th option “php.exe path, optional (CLI command tools)”.
  12. You may select “PEAR_Frontend_Gtk2” and “MDB2” optional packages too for installation.
  13. Then click on “Install” button. The installation will begin and would download about 4-5 MB of data.
  14. After installation finish, open “php.ini” file, search for “include_path” setting. If there is a semicolon (;) at the beginning of the line, remove it to uncomment the line. Append “;C:\wamp\bin\php\php5.2.6\pear\PEAR” in the include path.
  15. Restart all services of WAMP Server.
  16. Open “http://localhost“. You should see PEAR installer page instead of WAMP Server’s default “index.php”; PEAR installer modifies this file and it will avail the WebFront (web application) of PEAR management. You can view and add more PEAR packages by clicking on the “list all packagenames” link.
  17. Now you have 2 ways to install the required PEAR packages (MIME_Type, Mail, Mail_Mime, Net_SMTP, Net_Socket), using the WebFront or using the “pear.bat” with Command Prompt. To use the pear.bat with Command Prompt, follow the instruction at Send email from localhost/WAMP server using PEAR Mail and GMail #install-pear-packages. To use the WebFront, click on the Package Search button in the left pane in WebFront; select “pear.php.net” for the Channel dropdown listbox; search and install each packages (MIME_Type, Mail, Mail_Mime, Net_SMTP, Net_Socket) one-by-one; and after installing packages, read ahead from here to process to sending email.