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: https://www.dotkernel.com/php-troubleshooting/fix-installing-pear-packages-with-php-7-2/
Source:
– http://stackoverflow.com/questions/62658/getting-pear-to-work-on-xampp-apache-mysql-stack-on-windows