How to run two PHP versions for two projects on same apache server ? - GeeksforGeeks

15 Nov, 2021
In this article, we will learn about running two versions of PHP on the same Apache server. To manage many domains, the Apache webserver uses virtual hosts on a single instance.
Prerequisite: We will be using the XAMPP server to use the Apache server and some knowledge to use it.
First, download the older version of XAMPP that can be of any version. The old version is XAMPP 1.8.2 and then later we install the latest version of the XAMPP. Both versions of the XAMPP will have the same apache server.
Steps:
Download xampp-win32-1.8.2-6-VC9-Installer.exeInstall the software.Click on the next.Change the name (better to use the XAMPP_1_8_2) so that later you will be able to differentiate between the new and old versions.Click on “install” to complete the installation process.
Download xampp-win32-1.8.2-6-VC9-Installer.exe
Download xampp-win32-1.8.2-6-VC9-Installer.exe
Install the software.
Install the software.
Click on the next.
Click on the next.
Change the name (better to use the XAMPP_1_8_2) so that later you will be able to differentiate between the new and old versions.
Change the name (better to use the XAMPP_1_8_2) so that later you will be able to differentiate between the new and old versions.
Click on “install” to complete the installation process.
Click on “install” to complete the installation process.
Open the folder location where you kept your XAMPP1_8_2.
Click on the Apache at the XAMPP_1_8_2 –> apache
Configure the file httpd CONF file to change the port for the new XAMPP. As two different versions of XAMPP cannot run on the same port, we need to change to the port.
Steps to change the port for the XAMPP1_8_2:
Open the file HTTP CONF file > change the port from the 80 to 8080.
After changing the port click on save and exit.
Now go to the extra folder
Changes to be done in the ssl CONF file
Change the Listen 443 to 444
Save all and exit.
Now download the XAMPP new version
Follow the same steps {1, 2, 3, 4, 5, 6}
Don’t change anything like the port.
Open the XAMPP1_8_2 control
Open the XAMPP new version control.
Note: You may face some problem with the port of 3306.
Change the port 3306 to 3307
Steps to change port:
Change the config file for the MySQL in “my.ini” file.
Change the config file for the MySQL in “my.ini” file.
Change the port to 3307
Change the port to 3307
Run the code:PHPPHP<?php    phpinfo();?>
Run the code:
PHP
<?php    phpinfo();?>
Save the above code in “htdocs” folder of the XAMPP folder for the new and older version.
Save the above code in “htdocs” folder of the XAMPP folder for the new and older version.
Save in “htdocs” folder of the XAMPP folder.
Save in “htdocs” folder of the XAMPP folder.
Similarly with XAMPP_1_8_2Now, open the browser then type the command .localhost/phpinfo.phpOutput:This is the one version 7.4.2.Now for the second version type the command .localhost:8080/phpinfo.phpOutput:Finally we are able to execute the two PHP version (7.4.2   and 5.4.27) in the same Apache server.My Personal Notes
arrow_drop_upSave
Similarly with XAMPP_1_8_2
Now, open the browser then type the command .
localhost/phpinfo.php
Output:
This is the one version 7.4.2.
Now for the second version type the command .
localhost:8080/phpinfo.php
Output:
Finally we are able to execute the two PHP version (7.4.2   and 5.4.27) in the same Apache server.
simmytarika5
PHP-Misc
PHP
Web Technologies
Web technologies Questions
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Insert Form Data into Database using PHP ?
How to convert array to string in PHP ?
How to Upload Image into Database and Display it using PHP ?
How to check whether an array is empty using PHP?
Comparing two dates in PHP
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
Top 10 Projects For Beginners To Practice HTML and CSS Skills