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/PH P_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\PHPC odeSniffer\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)
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/PH
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\PHPC
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)
Thank you sooooo much. Just made my afternoon better.
ReplyDeleteThank you very much. Works like a charm!
ReplyDelete1000 thanks. You saved me hours.
ReplyDeletehello ,thank you very much ,it's working very Good,
ReplyDeletecan you please give me details about phpmd configuration same like phpcs..???
Still not able to work with my easy php server. please help me.
ReplyDeleteThankyou for sharing!
ReplyDeleteThank you very much. Work very good
ReplyDeleteThanks, worked like a charm!
ReplyDeleteThank you so much. Works like a charm and I can finally get some sleep :)
ReplyDelete