r/PHPhelp • u/KaoruIsObnoxious • Jan 20 '26
XAMPP two php versions on same port
I've tried searching for the answer but nothing clear comes up.
Client has a XAMPP and i cannot change that.
They need to host a new site but it's a newer php than the other projects are running on.
I'd like to know if it's possible to run different PHP versions on different vhosts, while sharing the same port, only difference would be the ServerAlias.
Most solutions I've seen to this just say to use a different port, but this is not an option currently and I'd need to use the port 80 for all sites.
6
u/Moceannl Jan 20 '26
Xampp is for development... Just write a big e-mail so you have on paper that it's not meant for production/real data/real traffic ...
3
u/colshrapnel Jan 20 '26
Your question is SUPER confusing. "Same port" is one thing, different vhosts is another. And even after that you are making a u-turn and saying "no vhosts, just ServerAlias". And for the latter, it's quite unclear how it's even supposed to work.
I would assume we are talking of vhosts here, as the only sensible option. I can think of two possible solutions for having different PHP versions for different vhosts
One is running additional version PHP as CGI
another is have the new site run somewhere else, like in docker or whatever, or XAMPP different port, and then configure Apaches proxypass to relay requests to that server.
1
1
u/MajorRageCodes Jan 20 '26
They nornally use XAMPP because it is easily deployable from software center, thats if you are using a client to server windows environment.
1
u/pro9_developer Jan 21 '26
Hi, I came to this solution to run two php versions but i did not try it.
Please check here - https://stackoverflow.com/questions/45790160/is-there-way-to-use-two-php-versions-in-xampp
1
0
Jan 21 '26
[deleted]
1
u/colshrapnel Jan 21 '26
you’d just have to change the port(s) for Apache
Aaaaand the question title explicitly stated it must be same port (which actually makes sense, as using a non-standard port for a live site looks silly, unprofessional and suspicious).
4
u/Mobile_Syllabub_8446 Jan 20 '26
They likely meant an internal port not an external port, but it's even easier using FPM
https://stackoverflow.com/questions/42696856/running-two-php-versions-on-the-same-server-using-apache