How to use php-cli when using Xampp in Ubuntu?

1. Open up /etc/environment file in your text editor.
2. Append /opt/lampp/bin to the location searched for binary files in the etc/environment file.
3.After appending /opt/lampp/bin, the /etc/environment file may look like this:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/lampp/bin
4. Save this file.
5. After this run source /etc/environment from command line.
NOTE: If you still cannot use php cli in your project then simply run source /etc/environment from inside your project’s root.
This worked for me. I Hope it works for you as well.
Happy coding 😉

Leave a Reply

Your email address will not be published. Required fields are marked *