✅ Set XAMPP PHP as default using vi
1️⃣ Open your shell config with vi
For bash (most common):
vi ~/.bashrc
For zsh:
vi ~/.zshrc
2️⃣ Edit the file in vi
- Press
i→ enter INSERT mode - Go to the bottom of the file
- Add this line:
export PATH=/opt/lampp/bin:$PATH
3️⃣ Save and exit vi
- Press
Esc - Type:
:wq
- Press Enter
4️⃣ Reload the config
source ~/.bashrc
# or
source ~/.zshrc
5️⃣ Verify ✅
which php
php -v
Expected output:
/opt/lampp/bin/php
🔁 Temporary (current terminal only)
export PATH=/opt/lampp/bin:$PATH
🔍 Debug if it still shows /usr/bin/php
type -a php
echo $PATH

I’m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I’ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains:
-
DevOps School – Tech blogs and tutorials
-
Holiday Landmark – Travel stories and guides
-
Stocks Mantra – Stock market strategies and tips
-
My Medic Plus – Health and fitness guidance
-
TrueReviewNow – Honest product reviews
-
Wizbrand – SEO and digital tools for businesses
I’m also exploring the fascinating world of Quantum Computing.
Best Cardiac Hospitals Near You
Discover top heart hospitals, cardiology centers & cardiac care services by city.
Advanced Heart Care • Trusted Hospitals • Expert Teams
View Best Hospitals