Friday, May 3, 2024
21
rated 0 times [  21] [ 0]  / answers: 1 / hits: 199781  / 3 Years ago, fri, october 29, 2021, 12:05:45

I have installed XAMPP v1.8.3 for my PHP development. I am new to Ubuntu, so I don't know how to set environment variable for PHP which is located at /opt/lampp/bin/php.



I can run PHP scripts from localhost just fine, but I wanted to run them from the command line as well.



I want to set this variable for every user, since I am the only one who uses this system.


More From » command-line

 Answers
4

Environment variables are set in /etc/environment. You will find the $PATH variable in this file. This variable stores the path to binaries in various locations.



To add /opt/lampp/bin to the location searched for binary files, just append this path preceded by a : to the path variable.



For example, if the $PATH variable was:



/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games


add /opt/lampp/bin to the end of it, so that it becomes:



/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/lampp/bin


After doing this, do a source /etc/environment.


[#26047] Friday, October 29, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
llael

Total Points: 209
Total Questions: 102
Total Answers: 118

Location: Rwanda
Member since Fri, May 5, 2023
1 Year ago
;