0

My system is win7. I have installed XAMPP on the system successfully.Besides, I have set the environment variables:

PHP_HOME=C:\xampp\php

Path=%PHP_HOME%

But when i run php code in git bash ,it appears the error:"sh.exe:php:command not found"

How can i solve the problem?

6
  • 1
    What happens when you cd into /c/xampp/php - is the PHP binary there? Can you execute it? Commented Jan 6, 2012 at 16:58
  • What did you write in git bash??I don't think you need to run php process for git work.. Commented Jan 6, 2012 at 17:00
  • the PHP binary is there. Commented Jan 6, 2012 at 17:18
  • I am using symfony2 ,it needs php code Commented Jan 6, 2012 at 17:18
  • Is the PHP binary in your PATH? Commented Jan 6, 2012 at 18:23

3 Answers 3

1

In my case I can solved my problem in this way ...

Go to PHP directory in the XAMPP folder and run the code in this way with the XAMPP server:

$ Php /c/xampp/htdocs/cupon/bin/vendors install
Sign up to request clarification or add additional context in comments.

1 Comment

nice reverse of regular thinking but okay, works for me!
0

As far as i was trying to execute MSVC compiler from within Java, i got the idea of all that Win7: the shell you are running something has different environment variables that you think you've set.

I recommend you to insall WAMP server - it is totally compatible with Windows while XAMPP seems to be a bit hard way to start with.

And one more hint: try running php / sh from the bin/ PHP directory.

2 Comments

If you think the X in XAMPP is for Mac OS X, then your are wrong. It stands for cross-platform because it is available for Linux, Windows, Mac OS X and Solaris :) (but still, that could be the reason that it does not integrate perfectly with Windows).
Thank for your consideration. It has worked after i restart my computer.
0

If you're using Windows and getting the "php: command not found" error, it means that the PHP executable is not in your system's PATH environment variable. Here are the steps to fix it:

  1. Find the location of your PHP installation. By default, PHP is installed in the "C:\php" directory. If you've installed PHP in a different location, note down that path.
  2. Add the PHP directory to the system's PATH environment variable:
    • Open the Start menu and search for "Environment Variables."
    • Click on "Edit the system environment variables."
    • Click on the "Environment Variables" button at the bottom of the window.
    • Under "System Variables," scroll down and find the "Path" variable. Click "Edit."
    • Click "New" and enter the path to your PHP directory (e.g., "C:\php").
    • Click "OK" to close all the windows.
  3. Close and reopen your terminal or command prompt to apply the changes.
  4. Verify that PHP is working by running the command "php -v" in your terminal or command prompt. You should see the version of PHP installed on your system.

If PHP is still not working after following these steps, you may need to reinstall PHP or check that the PHP executable file is in the correct directory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.