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.
1 2 3 4 5 6 7 8 9 10 |
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.
1 2 3 4 5 6 7 |
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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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 !! 🙂