Asudahlah.com

Programming, tutorials, mechatronics, operating systems, and other tech stuff

How to set up XAMPP-bundled php path in windows 7

2 comments
Most student, teacher, or even web developer used bundled webserver applications for their projects such as xampp or uniserv.

When using native php installation, we may use 'php' command directly from command prompt / terminal to use php cli. But if we are using xampp, because the php executable path is not defined in the system environment by default, we need to call php executable bin by complete path such as 'C:\xampp\php\php.exe' everytime to run php cli which is very annoying.

To avoid doing so, we can manually define php executable path in windows system environment You can do that by following these steps.

First, find out where your php executable is located. In XAMPP, it's in C:\xampp\php by default. You may copy the path from address bar to avoid typo.
Next, open your Environment variables by going through : Left click My Computer, Properties, Advanced system settings, and then click Environment Variables.

Choose PATH from System Variables, Edit...

Then at the end of Variable Value, Add (DO NOT REPLACE ANYTHING, just append at the end) a semicolon, followed by your php executable path so it will looks like:
<anotherEntries>;C:\xampp\php
Every entries are separated by semicolon

Hit OK three times to close all windows.

Open your command prompt, and try command:
php -v

your current php version should be displayed. which means from now on you can directly call 'php' from your command prompt to use php cli.

That concludes this tutorial. You can watch the video below to understand this tutorial better.



2 comments :

Post a Comment