Asked  7 Months ago    Answers:  5   Viewed   61 times

I got the following error when I run a command with php

C:xampphtdocs>php
'php' is not recognized as an internal or external command,
operable program or batch file.

I don't get any error when I run the command with php in following path:

C:xamppphp>php  //do not got error here

Why I get this error?

'php' is not recognized as an internal or external command, operable program or batch file.

 Answers

87

Add C:xamppphp to your PATH environment variable.(My Computer->properties -> Advanced system setting-> Environment Variables->edit path)

Then close your command prompt and restart again.

Note: It's very important to close your command prompt and restart again otherwise changes will not be reflected.

Wednesday, March 31, 2021
 
Classified
answered 7 Months ago
14

Add 2>&1 to the end of your command to redirect errors from stderr to stdout. This should make it clear what's going wrong.

Wednesday, March 31, 2021
 
Palladium
answered 7 Months ago
12

First of all, what is the version of PHP?

If other .php scripts work except for phpMyAdmin, the is pretty safe to assume something is wrong with phpMyAdmin installation. (either with the files or the Virtual Host)


Troubleshoot:

  1. Can you run another script in phpMyAdmin directory? Try with a file containing phpinfo(); If it does not work then the problem is in your apache configuration.

  2. If the above is true, then the parser is not recognising phpMyAdmin/index.php as a php file, for some reason. Try reinstalling phpMyAdmin.


Thoughts:

Remove AddType application/x-httpd-php .php. You should not need it.

In PHP 5.4 magic_quotes_gpc was removed. If you're running PHP5, remove that line.

As of PHP 4.0.3, track_vars is always turned on, so remove it also.

As of PHP 4.2.0, register_globals this directive defaults to off. In PHP5.3 register_globals is deprecated, as of PHP5.4 register_globals was removed. SO if running PHP > 4.2.0 remove that line.

Saturday, May 29, 2021
 
vuliad
answered 5 Months ago
45

I think you need to change it to A:xamppphp and just leave it there, then it will search the directory for the file, also: have you tried calling just php instead of php.exe and check that the directory is correct.

Monday, June 14, 2021
 
anjan
answered 5 Months ago
15

You need to use the Visual Studio command prompt to use the makecert utility on the command line.

Sunday, September 26, 2021
 
BlueNile
answered 3 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share