ERROR: failed to mkdir C:\php\pear\tests\PHP_CodeSniffer\CodeSniffer\Core\File [Solved]

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.

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.

Now it works !! 🙂


  1. Warning: mkdir(): Permission denied in /Applications/XAMPP/xamppfiles/htdocs/php254/lecture25 2015.03.26/project/topics/file_upload/process_upload.php on line 130
    failed to create folder users

    I have big problem for mac for above

  2. I had the same error ‘failed to mkdir C:\php\pear\tests\PHP_CodeSniffer\CodeSniffer\Core\File’ but setting the pear config did not work for me, it would still try to install in C:\php instead of C:\xampp\php. It took me some time to find the solutiuon so I will post it here in case others have the same problem:

    Run your terminal window as administrator
    Apparently, if you dont, the commands pear config-set will not work. So after I ran my command window as administrator I went to c:\xampp\php and ran the commands:

    pear config-set doc_dir C:\xampp\php\pear\docs
    pear config-set cfg_dir C:\xampp\php\pear\cfg
    pear config-set data_dir C:\xampp\php\pear\data
    pear config-set man_dir C:\xampp\php\local\man
    pear config-set test_dir C:\xampp\php\pear\tests
    pear config-set www_dir C:\xampp\php\pear\www

    pear install PHP_CodeSniffer

    Finally it worked.


Leave a Reply