Setting path for PHP CLI

What is that for?

my friend asked my a question after lunch.

Well, install php using file from php.net don’t automatically set environment path for php location.

As result we must type full location of php.exe each time we must execute php from command line.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>php -v
PHP 5.2.3 (cli) (built: May 31 2007 09:37:22)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

C:\Documents and Settings\Administrator>cd ..

C:\Documents and Settings>php -v
PHP 5.2.3 (cli) (built: May 31 2007 09:37:22)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

C:\Documents and Settings>d:

D:\>php -v
PHP 5.2.3 (cli) (built: May 31 2007 09:37:22)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

D:\>

Yes, by setting path for php we can execute php.exe from any place in windows.

To set that path, just right click on My Computer:

Click Advance

Environment variables for input php location.

I install php in c:\php.

Click OK.

Done 🙂

Tags: