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)

Tuesday, July 2, 2013

lighhttpd dead but subsys locked

Recently I was assigned a work to run a .sh file from php script. This .sh file will execute some Linux commands to move the data from one server to another. After completion of moving part, need to restart the lighthttpd server to take all the changes updated.

This script is working perfectly when we ran from the command line but throwing error "lighhttpd dead but subsys locked" from php script. So I did debug and googled to find the problem and I found that issue with "Service restart" command.


At last I resolved the issue by changing from Service <service name> restart to Service <service name> stop and Service <service name> start individually