How to set an environment variable for installing PHP via XAMPP on Ubuntu

To set an environment variable for installing PHP via XAMPP on Ubuntu, you typically don’t need to set specific environment variables for XAMPP itself. However, you might want to adjust your system’s PATH variable to include XAMPP’s PHP binary directory so that you can use PHP commands from the command line without specifying the full path.

Locate XAMPP’s PHP Binary Directory: This is typically located within your XAMPP installation directory. The PHP binary itself is usually found in the bin directory inside the XAMPP folder.

Open your shell configuration file: This could be ~/.bashrc, ~/.bash_profile, or ~/.profile. You can use any text editor to open the file. For example, you can use nano:

nano ~/.bashrc

Add XAMPP’s PHP Binary Directory to PATH: Add the following line at the end of the file, replacing /path/to/xampp/php with the actual path to your XAMPP’s PHP binary directory:

export PATH="/path/to/xampp/php:$PATH"

Make sure to replace /path/to/xampp/php with the actual path. If your XAMPP is installed in the default location, it might look like this:

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

Save and Close the File: In nano, you can do this by pressing Ctrl + O to save the file and then Ctrl + X to exit.

Apply the Changes: After saving the file, you need to apply the changes to your current shell session. You can either close and reopen your terminal or run:

source ~/.bashrc

Verify: You can now verify that the changes have taken effect by running:

php -v

This should display the version of PHP installed with XAMPP.

Related Posts

How to upload sql file to database using PhpMyAdmin in Xampp

To upload an SQL file to your database using phpMyAdmin in XAMPP, you would typically use the phpMyAdmin web interface rather than a command-line interface. However, if…

Read More

Connection Timeout and large size import Error in PhpMyAdmin (XAMPP)

To increase the timeout and import size in phpMyAdmin on XAMPP for Ubuntu, you’ll need to adjust several configuration settings related to PHP and phpMyAdmin itself. Here’s…

Read More

How to install php.x.x-gd and php.x.x-sodium manually in ubuntu if Composer update failed

If you running COMPOSER UPDATE in ubuntu and if it failed due to below error :php.x.x-gd and php.x.x-sodium extension missing To install and enable the PHP 8.2…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x