You can do this:
Switch to root user
sudo su -
Edit the .bashrc
vi ~/.bashrc
And add a new path to the current one:
export PATH=$PATH:/opt/lampp/bin
Question
I was struggling with apache2 already installed in ubuntu so I decided to return back to lampp..I have unistalled apache 2 mysql server and phpmyadmin.
The problem is that when I type sudo which php
I get nothing...
So I cannot request e.g. sudo composer create-project laravel/laravel.....
since php is missing for root user..
Although when I type which php
I get /opt/lampp/bin/php..
Is it possible to make the root user use the same path..?
Solution
You can do this:
Switch to root user
sudo su -
Edit the .bashrc
vi ~/.bashrc
And add a new path to the current one:
export PATH=$PATH:/opt/lampp/bin