Installing PEAR packages in XAMPP Windows

First open command prompt administrator because the script will try to write c:\windows\pear.ini

Next run this commands in xampp\php folder:
pear config-set doc_dir \xampp\php\docs\PEAR
pear config-set cfg_dir \xampp\php\cfg
pear config-set data_dir \xampp\php\data\PEAR
pear config-set test_dir \xampp\php\tests
pear config-set www_dir \xampp\php\www

Then you can install any packages using this command:
pear install <package-name>

example: pear install mail

Note: if you are using php 7.2, you might get error “PHP Fatal error: Cannot use result of built-in function in write context in \xampp\php\pear\Archive\Tar.php on line xxx”, read this to fix it:


Leave a Reply

Your email address will not be published. Required fields are marked *