Flipkart

Friday, July 5, 2013

"@php_bin@" is not recognized as an internal or external command, operable program or batch file.

After lot of struggle I was able to install the PEAR and PHPCodeSniffer in Xampp (Windows). In this process, I have faced lot of problems to run the PHPCodeSniffer properly. In this process, I found lot of good articles which explained me well from the beginning. But I spent lot of time to fix the error  "@php_bin@ is not recognized as an internal or external command, operable program or batch file."

Here is the solution which worked for me I hope it will be useful to others also:

1. First Download PHPCodeSniffer from http://pear.php.net/package/PHP_CodeSniffer/download and extract this in your Local directory. In my case I have extracted in xampp/htdocs

2. Find phpcs.bat file that you extracted, open it by using your fav. editor and define 2 variable to set the paths manually.

set phpbin="D:\xampp\php\php.exe" (This is the php.exe path)
set location="D:\xampp\htdocs\PHPCodeSniffer\scripts" (This is the path where phpcs.bat is located)

and replace actual line with below given line
"%phpbin%" -d auto_append_file="" -d auto_prepend_file="" -d include_path="'%phpbin%'" -f "%location%\phpcs" -- %*

3. open command line and execute the phpcs file with the specific .php as a argument. Ex:

> phpcs D:\xampp\htdocs\test.php (add path before phpcs if you did not set the environment variable for phpcs)

9 comments:

  1. Thank you sooooo much. Just made my afternoon better.

    ReplyDelete
  2. Thank you very much. Works like a charm!

    ReplyDelete
  3. 1000 thanks. You saved me hours.

    ReplyDelete
  4. hello ,thank you very much ,it's working very Good,
    can you please give me details about phpmd configuration same like phpcs..???

    ReplyDelete
  5. Still not able to work with my easy php server. please help me.

    ReplyDelete
  6. Thankyou for sharing!

    ReplyDelete
  7. Thank you very much. Work very good

    ReplyDelete
  8. Thanks, worked like a charm!

    ReplyDelete
  9. Thank you so much. Works like a charm and I can finally get some sleep :)

    ReplyDelete