Use XAMPP PHP CLI in your command line

To use XAMPP’s PHP as default PHP in your command line to execute PHP commands from
your command line/prompt you have to just follow the simple steps mentioned below:

in this tutorial I used UBUNTU as my OS

Open your terminal and open .bashrc file by following command:

sudo gedit ~/.bashrc

If you don’t use GUI or gedit not installed then you can use vim instead of gedit like following

sudo vim ~/.bashrc

and just you have to add the following line at the end of your .bashrc file.

export PATH=/opt/lampp/bin:$PATH

Now restart your terminal and you are done!
Now type php -v to verify that it’s working. this php -v command will show you the
PHP version used in your command line. Happy PHP’ing.

Shaharia is a professional software engineer with more than 10 years of experience in the relevant fields. Digital ad certified, cloud platform architect, Big data enthusiasts, tech early adopters.

Site Footer