php is not recognized
Posted by: RangerWalt (---.rochester.res.rr.com)
Date: May 29, 2013 05:24PM

I just installed wampserver on Windows XP and tried to execute hello.php from the command line. I get " 'php' is not recognized as a program, executable or batch file." error message.

I added php to the path and pathtext environmental variables

Options: ReplyQuote
Re: php is not recognized
Posted by: RiggsFolly (---.as13285.net)
Date: May 29, 2013 05:37PM

You dont need to add php to the path or anything else unless you are using the CLI

But you do have to run your scripts via the prowser and not use a doubleclick on the php file name

Options: ReplyQuote
Re: php is not recognized
Posted by: zdy (27.17.16.---)
Date: May 30, 2013 10:58AM

You'll have to add the directory in which the php executable is located to your "path" variable (I guess in your case that would be E:\logiciels\UwAmp\apache\php_5.2.11 ). In Windows, you can do that as described here: [www.computerhope.com]

Any directory you place in this path variable (they're separated by a semicolon) will be automatically used in, for example, a cmd shell.
The path is now managed by Windows 2000 and Windows XP and not the autoexec.bat or autoexec.nt files as was done with earlier versions of Windows. To change the system environment variables, follow the below steps.

From the Desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below. www.cusabio.com/hot/Antibody.html Antibody

C:\Program Files;C:\Winnt;C:\Winnt\System32.......



Edited 1 time(s). Last edit at 05/30/2013 10:59AM by zdy.

Options: ReplyQuote
Re: php is not recognized
Posted by: RiggsFolly (---.as13285.net)
Date: May 30, 2013 12:57PM

Sorry,

Missed the bit about the command line.

I prefer not to add php to the PATH as when I change versions of PHP I have to remember to change the PATH as well.

I use a little batch file that I run from the command line before trying to execute a php script in CLI.

Place this file in a folder that is already on your path.


--------------------- phppath.cmd ---------------
path=%path%;c:\wamp\bin\php\php5.3.22;c:\wamp\bin\mysql\mysql5.5.28\bin
php -v
mysql -V
------------------------------------------------

This allows me to execute php scripts and the mysql command line from anywhere as long as you run this batch file first.


Obviously change the version numbers in the folder names to suit your current versions of PHP and MYSQL

Options: ReplyQuote


Sorry, only registered users may post in this forum.