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.
- 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.
- 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”.
- Enable “php_sockets” and “php_openssl” extensions of PHP:
- Enable “ssl_module” module of Apache:
- Create a folder named “pear” inside “C:\wamp\bin\php\php5.2.6” folder.
- Click this link http://pear.php.net/go-pear; a PHP Script file will be shown.
- Press Ctrl + S to save the file. Give “go-pear.php” name to it and save it in the “C:\wamp\www” folder.
- Click this link http://localhost/go-pear.php to start setup of PEAR.
- In the page, click on “Next>>”, “Packages” page will be shown.
- In “Configurations” section, set “Installation Prefix ($prefix)” to “C:\wamp\bin\php\php5.2.6\pear”.
- You may set “C:\wamp\bin\php\php5.2.6” for the 11th option “php.exe path, optional (CLI command tools)”.
- You may select “PEAR_Frontend_Gtk2” and “MDB2” optional packages too for installation.
- Then click on “Install” button. The installation will begin and would download about 4-5 MB of data.
- 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.
- Restart all services of WAMP Server.
- 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.
- 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.
Hi,
following this tutorial, during installation phase I received following error:
Class ‘PEAR’ not found in C:\wamp\www\go-pear.php on line 697
and installation stops.
guide me please.
regards
It seems that the “include_path” setting of php.ini doesn’t include the path to the PEAR folder. Please open “C:\wamp\bin\apache\apacheX.Y.Z\php.ini”, search for “include_path” setting. Secondly, search for PEAR folder in WAMP’s folder; it is mostly at “C:\wamp\bin\php\phpX.Y.Z\PEAR”. Add this path with already defined value of “include_path” setting in php.ini. The setting’s line should be similar to this:
include_path = ".;C:\wamp\bin\php\php5.2.6\PEAR"
im getting this error during installation..
Deprecated: Function ereg() is deprecated in C:\wamp\www\go-pear.php on line 1451
any help
PEAR packages are very great idea but the problem with most of PEAR packages is – they are not updated since some years. The error you have mentioned is also because of this laziness.
ereg()
is POSIX function and now they are considered deprecated (more info: PHP: ereg – Manual). So, now the PEAR packages should be updated to replace the deprecated functions with newer preferred function. Currently, PCRE regular expression functions are in use.ereg
‘s alternative function ispreg_match()
.However, presently, the error you are seeing is just a warning, and it can be ignored. To ignore warnings of deprecated functions, you can set the
error_reporting
setting in php.ini file. Search for “error_reporting” in php.ini and add “& ~E_DEPRECATED
” at the end of this line.Hi Sir,
Im getting below error
Strict standards: Non-static method PEAR::setErrorHandling() should not be called statically in C:\wamp\www\go-pear.php on line 697.
Help me please.
Regards,
Channabasappa.
It looks like there is a bug in the PEAR package. I think this is the same/similar error/bug report on PEAR’s website:
https://pear.php.net/bugs/bug.php?id=9950
So, according to a comment on this page, posted by qtx (Ihor Maskov) on 2009-11-13 19:33 UTC, you can try by replacing
$parser::parseAddressList
with$parser->parseAddressList
to solve the issue. However there could be more same/similar bugs in the PEAR package(s).There is another comment on that page, posted by patri_ferrnandez (Patricia Fernández) on 2012-12-13 19:32 UTC who is saying that she wrote
static
keyword in the functionsetErrorHandling
, inside Pear.php to solve the error. And I think, this solution will solve all such errors; however this is not advisable because it is against PEAR development guidelines.Hi sir,
I apparently have this error when i run the localhost page
Error: the template directory (C:\php\pear\data\PEAR_Frontend_Web\data\templates) is not a directory, or not readable. Make sure the ‘data_dir’ of your config file (C:\php\pear\data) points to the correct location !
Could you help me thanks.
It seems incorrect path has been set somewhere during installing or configuring PEAR. So, please be sure that 11th and 14th steps are followed properly. Also check the php.ini for PEAR’s path.