If your PHP installation has been done somewhere else other than the C:\ drive, then “pear install” command may throw errors.
Example: Here in my case, the xampp has been installed into E:\ drive and the “pear install” throws error.
E:\xampp\php>pear install PHP_CodeSniffer WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-upd ate pear.php.net" to update downloading PHP_CodeSniffer-2.0.0.tgz ... Starting to download PHP_CodeSniffer-2.0.0.tgz (448,559 bytes) ................................................................................ ..........done: 448,559 bytes ERROR: failed to mkdir C:\php\pear\tests\PHP_CodeSniffer\CodeSniffer\Core\File
Solution:
I get into the “pear” directory and checked config values set for different pear related directories. All were set to C:\ drive by default. So, we need to change those settings to correct path.
pear config-set doc_dir E:\xampp\php\pear pear config-set cfg_dir E:\xampp\php\pear pear config-set data_dir E:\xampp\php\pear pear config-set test_dir E:\xampp\php\pear pear config-set www_dir E:\xampp\php\pear
E:\xampp\php> E:\xampp\php>pear config-set doc_dir E:\xampp\php\pear config-set succeeded E:\xampp\php>pear config-set cfg_dir E:\xampp\php\pear config-set succeeded E:\xampp\php>pear config-set data_dir E:\xampp\php\pear config-set succeeded E:\xampp\php>pear config-set test_dir E:\xampp\php\pear config-set succeeded E:\xampp\php>pear config-set www_dir E:\xampp\php\pear config-set succeeded E:\xampp\php>pear install PHP_CodeSniffer WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-upd ate pear.php.net" to update downloading PHP_CodeSniffer-2.0.0.tgz ... Starting to download PHP_CodeSniffer-2.0.0.tgz (448,559 bytes) .............................done: 448,559 bytes install ok: channel://pear.php.net/PHP_CodeSniffer-2.0.0 E:\xampp\php>
Now it works !! 🙂
Leave a Reply