Today we are going to learn about managing multiple PHP versions on ubuntu with xampp.
XAMPP is a popular development environment that combines Apache, MySQL, PHP, and Perl, making it easy for developers to create and test web applications locally. However, as projects evolve, you may need to switch between different PHP versions to ensure compatibility and functionality.
In this article, we will guide you through the process of managing multiple PHP versions in XAMPP on a Linux Ubuntu operating system.
Download and install XAMPP on your Ubuntu machine if you haven’t already. You can find the installation instructions on the Apache Friends website.
Now try to run following command:
sudo xampp start
If it is not working, then probably you haven’t configured the xampp cli yet.
Run the below command to enable XAMPP commands.
sudo ln -s /opt/lampp/xampp /usr/local/bin/xampp
Here /opt/lampp
is the directory where the xampp server is installed. Now, it will add the XAMPP to the CLI. You can run below command to test it.
sudo xampp start
sudo xampp stop
Okay, the next step is to install multiple xampp with different PHP versions.
Now rename the existing /otp/lampp
to /opt/lampp_php_version
, for example if current xampp is for PHP 5.6 then name it lampp_5.6
Run the following linux command to do that:
sudo mv /opt/lampp /opt/lampp_5.6
Let’s suppose you have installed a new XAMPP with PHP 7.4 then rename it lampp_7.4
to install the next XAMPP version. This way you can install as much as you need. At the end at least one XAMPP should be without a rename meaning it should be simply /opt/lampp
.
You can create www
folder in the home directory. For example, /home/username/www
Then run remove the htdocs from /opt/lampp
directory. Now run the below command:
sudo ln -s /home/satpal/www /opt/lampp/htdocs
It will create the symlink in the lampp directory, when we switch the multiple PHP version even then this directory and included projects will be the same.
First you have to open all lampp
, lampp_5.6
, lampp_7.4
etc. and perform the same action.
Till now, you have set everything properly. It’s time to install a command to switch the php versions with xampp. Download the switch-xampp
and place it to /usr/local/bin/
You can run the following command from your downloads folder to copy and paste the switch-xampp
file to the destination:
sudo cp switch-xampp /usr/local/bin/
Run the below command to test the whole setup:
sudo switch-xampp 7.4
Let's understand about how to use coding to improve your website's SEO. In today’s computerized…
Let's understand the most important linux commands for web developers. Linux, as an open-source and…
Today we are going to discuss top 75+ Laravel interview questions asked by top MNCs.Laravel,…
Today we will discuss about the Mailtrap integration with laravel 10 .Sending and receiving emails…
Today we are going to integrate FCM (Firebase Cloud Messaging) push notifications with ionic application.Firebase…
Uncaught TypeErrror: append called on an object that does not implement interface FormData. JQuery has…