Setting up PHP-CLI on Windows XP
This is just a quick one, but something I found information about strikingly absent.
All the PHP-CLI guides explain how to install it so typing “php -v” gives you the expected CLI response, but nobody bothered to explain how to link PHP scripts so you can run them like an EXE without having to type PHP first.
Grab PHP from any of the php.net FTPs. If you’re lazy like me, get both the zip and the installer–the installer lacks all the goodies like zip support and GDLIB.
Run the installer, stick it in C:\PHP, choose not to configure a web server. Next, open the zip, extract everything into the same folder. Rename php.exe to php2.exe or php.exe.bak. Now copy the php.exe from the C:\PHP\CLI folder to C:\PHP.
Right-click My Computer and pick properties. Click the Advanced tab, then the Environment Variables at the bottom. In the second list-box you’ll see a line for PATH. Double-click it and add to the end of the existing line “;C:\PHP” This should give you something like:
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;
C:\Program Files\Command;C:\PHP
Click OK.
Now open a Command Prompt and type the following lines:
ASSOC .php=PHPScript
FTYPE PHPScript="C:\PHP\PHP.EXE" "%1" %*
You’re all set. You can now just type a PHP script name to run it like an EXE. No need to type PHP first.
Related Posts
- Playing Langrisser I on Ubuntu...
- How To: Ubuntu and Windows printers...
- How To: VirtualBox MIDI in an XP guest...
- Authori Server Functions...
Related posts brought to you by Yet Another Related Posts Plugin.
About this entry
You’re currently reading “Setting up PHP-CLI on Windows XP,” an entry on CinnamonPirate.com
- Published:
- Saturday, March 12th, 2005 at 1:07 am
- Author:
- Derrick Sobodash
- Previous:
- The site was redesigned












2 Comments
Jump to comment form | comments rss | trackback uri