How to Set Multiple PHP Versions in XAMPP
Ғылым және технология
By the end of this video, you're going to find out everything you need to know to install multiple PHP versions in XAMPP on a Windows machine.
Article: neutrondev.com/multiple-php-v...
Resources:
windows.php.net/downloads/rel...
gist.github.com/Tynael/e69c02...
================
Connect with me:
================
Twitter: / pelu_carol
Facebook: / neutrondevcom
Instagram: / neutrondevcom
GitHub: github.com/Tynael
Site: neutrondev.com/
Newsletter: neutrondev.com/newsletter/
⏲️ Timestamps ⏲️
00:00 - Intro
00:20 - Brief
00:39 - How to download the right PHP version
02:44 - Configure php.ini
04:31 - Set Windows Environment variable for PHP (if not already)
06:08 - Apache configuration
07:50 - Conclusions
================
#php #xampp #windows
Пікірлер: 147
Post: neutrondev.com/multiple-php-versions-in-xampp/
I tried your method and it's working perfectly I now have 3 versions of php 7.4, 8.0 and 8.1. Thank you dude you are a life saver
@NeutronDev
9 ай бұрын
Good job! Glad you found it helpful 💜
This has been invaluable, thank you
@NeutronDev
Жыл бұрын
Glad you found it helpful 💜
For some years ago it was a nightmare :) many thanks! BRAVO!
@NeutronDev
Жыл бұрын
Yup, indeed. Glad you found it helpful 💜
Thank you! For sharing your resources and knowledge. Be healthy and successful! 👍🏻💪🏻
@NeutronDev
Жыл бұрын
Thank you, kind sir! Stay healthy and enjoy the ride 💜
Thanks man! it works perfectly. I used to install different xampp versions, just tweaking the config. but this method is much easier. cheers!
@NeutronDev
2 ай бұрын
You're welcome 💜
Thank you for sharing the knowledge.
@NeutronDev
6 ай бұрын
🫡
Keep it up, you are doing very well. Just make sure that your video has enough zoom level.
@NeutronDev
2 жыл бұрын
Thank you 💙! That's a valid point. I'm recording on a big screen and the zoom level may sometimes be disproportionate.
works well, thank you so much!!
@NeutronDev
Жыл бұрын
Awesome 💜
Great Video... Helped me Lot... Thank You..
@NeutronDev
Жыл бұрын
Glad you found it helpful
Great video. Thanks bro
@NeutronDev
7 ай бұрын
Thanks! You're welcome 💜
Great Job, thank you very much
@NeutronDev
Жыл бұрын
Thanks 💜, you are welcome!
Thank you mate this works perfectly.
@NeutronDev
Жыл бұрын
Glad you found it helpful 💜
@NeutronDev
Жыл бұрын
Awesome! 💪
This is helpful, thank you
@NeutronDev
11 ай бұрын
Glad you found it helpful 💜
Thank you 🙌🙌
Thanks very much. Im very grateful 👏👏
@NeutronDev
Жыл бұрын
Aww 💜 glad you found it helpful
Works fine, thanx! In my case I preferred to rename the older version (to avoid reset the PHP system environment variable) and keep using /php for the newest one. Something else, when I tryed to launch the Apache server, it never ran. This is because I needed to copy the directory /extras from your older version (something related to browscap.ini file, don't overwrite just copy the missing ones).
@NeutronDev
5 ай бұрын
Great 💜 Thanks for sharing!
Thank u so much man!
@NeutronDev
6 ай бұрын
You're welcome 💜
Thank you, it saved my time.
@NeutronDev
3 ай бұрын
Awesome 💜
You are awesome! :)
@NeutronDev
8 ай бұрын
💜
Nice video
amazing, thanks!!
@NeutronDev
12 күн бұрын
You're welcome 💜
tahnks help me a lot
@NeutronDev
Жыл бұрын
Glad you found it helpful 💜
thanks this is excellent . really save my time
@NeutronDev
5 ай бұрын
Awesome 💜
@amitkumar-jh1jg
5 ай бұрын
how do i switch between two versions
@NeutronDev
5 ай бұрын
@@amitkumar-jh1jg It depends on what "switch" means in your case. If you want a project running on a different PHP version, then set up the Apache httpd configs accordingly. If you want to change the PHP version for your Windows, then go to the PATH variables and edit it from there.
Thanks it worked
@NeutronDev
Ай бұрын
Awesome 💜
Спасибо большое!)))
@NeutronDev
Жыл бұрын
You're welcome
Nice! How can I do if want to work in some projects running the old PHP version? Should I delete the environment variables settled in the path??
@NeutronDev
10 ай бұрын
Hi! You don't have to delete the environment variable set in the PATH. You have to basically duplicate the Apache configuration xampp > apache > conf > extra > httpd-xampp.conf and tell it to use a certain PHP version as shown in the video. Of course, make sure you have installed the PHP version you want to use. You can also refer to the article from where you can copy & paste the code and adjust it to your needs: neutrondev.com/multiple-php-versions-in-xampp/
@tokemusical
10 ай бұрын
@@NeutronDev Get it . Thanks 😊👍
thank u very much
@NeutronDev
Жыл бұрын
You're welcome 💜
Hi there Neutron Dev, thanks for this great tutorial. However it didn't worked on my end, but I just noticed something, yours is using "FastCGI" on the server API, mine uses Apache 2.0 Handler, is the fastCGI required for multiple PHP versions?
@NeutronDev
Жыл бұрын
Hi, John! Thank you
@johnparayno6658
Жыл бұрын
@@NeutronDev No worries pal, I'm grateful you confirmed it's working due to Fast CGI. I'll be setting up mine to use Fast CGI as well, just looking for a tutorial on that. Thanks!
thanks!
@NeutronDev
Жыл бұрын
You're welcome 💜
thank you
@NeutronDev
5 ай бұрын
You're welcome 💜
I want to do the exercises in a head first PHP & mySQL textbook that was published in 2009. But the version of PHP they're using is PHP 5 or 6. Would I be able to download PHP 5 or 6 and run that version locally using the xampp server on my laptop computer? It is for learning purposes only and I do not plan on posting any of the work on an online server
@NeutronDev
8 ай бұрын
Yes, you can run even PHP 5 or 6. Make sure to also check my article because the settings are a bit different for PHP 5.
great
After doing this my .htaccess file does not work. The file was working in the old PHP with 'php_value include_path "C:/path/..."'. Now it does not work anymore. I tried setting "AllowOverride All" in the .conf file but nothing happened. How to solve?
@NeutronDev
10 ай бұрын
Hi! I don't currently have access to my PC. I can get back to you in a week.
@NeutronDev
10 ай бұрын
Did you figure it out in the meantime?
@tokemusical
10 ай бұрын
@@NeutronDev Still don't. What I did was setting the include path in the php.ini file. The .htaccess file doesn't work :/
@NeutronDev
10 ай бұрын
@@tokemusical I'd need to see what's in the "httpd-xampp.conf" and ".htaccess" file to be able to figure out what's wrong 🤔 Can you gather the code in a private Gist ( gist.github.com/)? Make sure you don't include any private/secret keys or credentials. You can send the link over to my email or here. Other things you may want to double-check or try: 1. Make sure the PHP versions you have are all Thread Safe or Non-Thread Safe. (You can find more info in the article) 2. Make sure the php.ini is correctly configured as mentioned in the article 3. Check .htaccess for any weird redirect/access rules
Why use an older version of XAMPP and go up to version 8.x? Can the newest XAMPP be used and go down to 7.x & 5.x?
@NeutronDev
2 жыл бұрын
Answer to question 1: Picture this scenario: you've been using XAMPP for 3 years and bam! a new PHP version comes out. You don't want to port all the projects to a new XAMPP version just because a new PHP version came out. So what do you do? Better install a new PHP version on the current XAMPP installation. Or, install a new XAMPP with the newest PHP installation. Answer to question 2: Yes.
@ibsmiley6313
2 жыл бұрын
@@NeutronDev So, it should also work if I used the newest version?
@NeutronDev
2 жыл бұрын
@@ibsmiley6313 Yup
I have two projects in different php version , how can I do to shift the php version depending that project I´ll work ?
@NeutronDev
10 ай бұрын
Set up the config as shown in the video (you can also consult the written article) and Apache will know what PHP version to use depending on the project you are using.
Your solution is working great, but somehow when I try to install PrestaShop, it doesn't work! I've also noticed that the "Server API" is not "Apache 2.0 Handler" but set to "CGI/FastCGI". Could you help me please?
@NeutronDev
2 ай бұрын
Hey! The solution should work with FastCGI. It doesn't work with Apache 2.0. What errors are you getting?
I have tried this method but yet, is not showing the current php i want to add. I have php 7.4.4 and wanted to add php 8.1.0 so i can run my laravel project but instead of running am seeing Windows 7.4.33 when i check the phpinfo in my xampp even though i have restarted the xampp severally. Please help
@NeutronDev
5 ай бұрын
Hey! Would be good to revisit all the configurations and make sure they are correct. You can also read the blog post. It's hard to guess what issue you're facing without seeing the files and their configurations.
sir i have 2 projects to set up one am already working with having php 7.4 another i has to setup 8.1 does both version can handle in a single xampp ?
@NeutronDev
9 ай бұрын
Yup, XAMPP can handle multiple PHP versions. Follow this tutorial and you're all set.
@vamshikrishnapatel4348
9 ай бұрын
hello sir i follwed what you said above afte httpd.conf in apachi i gave all paths as of mine now am not able to run apachi @@NeutronDev
@NeutronDev
9 ай бұрын
Check Apache's logs and see what's the issue. Pay close attention to all the settings shown in the video. You can also read the article if you find it easier to follow.
I followed your all steps but when you check for new version mine is still showing same the old one.. if i enter where php command then it is showing two different paths of php.exe i.e. C:\xampp\php\php.exe C:\xampp\php83\php.exe
@NeutronDev
5 ай бұрын
Hi! It looks like you've set up two Windows environment variables for PHP. You should have just one. I recommend going with PHP 8.3.
hi can i ask if, how i can change it back to the php version. Like i currently use php version 5.6.4 but i want to change it back to php version 8?
@cloverchips3350
3 ай бұрын
also, the php version have been change to 5.6.4, but when i visit to localhost and phpinfo the version doesnt change?
@NeutronDev
3 ай бұрын
Hey! You have to tell Apache to use PHP 8 for a certain project (see neutrondev.com/multiple-php-versions-in-xampp/#Apache_configuration)
@cloverchips3350
3 ай бұрын
@@NeutronDev last concern sir. the php version has been changed into php version 5.6.4, but when i visit localhost/phpinfo, it shows php version 8.0.
@NeutronDev
3 ай бұрын
Maybe you did not configure it properly. Hard to tell what's wrong without seeing the code.
how to switch the PHP version that I want to use?
@NeutronDev
11 ай бұрын
What do you mean? Can you expand a bit?
It seems that you know plenty about Xampp, so my question is this, how can we host a custom domain, that is visible on the public level (anyone can reach it) but thru xampp (domain that is not purchased from ICANN)
@NeutronDev
Жыл бұрын
Hey! That's a good question. As far as I'm aware, you cannot publicly expose a domain that basically doesn't exist (being unregistered). You can however expose the IP instead. Or better yet, you can register some free DNS / custom domains and use those instead of the IP.
@xznt.
Жыл бұрын
@@NeutronDev That is correct but can we host the dns server & resolver ourselves so we don't depend on the ICANN?
@NeutronDev
Жыл бұрын
@@xznt. You'd have to go through a domain registrar or become one 😅. AFAIK, ICANN oversees a set of DNS such as .com, .org & .net. You can use other domains that don't go through ICANN but through other domain registrars. One way or another, you cannot simply become an authority and register your own custom domain without others knowing about it. You can do whatever you want on your localhost or intranet (create custom domains, SMTPS etc) but not on WWW.
Is also the same that I would like to use laravel projects with different php versions? Can you answer me 🤩?
@NeutronDev
Жыл бұрын
Hi! Sorry, I don't understand your question 😬 If you're asking if you can use multiple PHP versions on multiple Laravel projects in XAMPP, then YES. I've ran multiple Laravel projects with different PHP versions for almost 2 years and it worked flawlessly.
@thinyadanarsu8122
Жыл бұрын
@@NeutronDev the question you think is right, so how did you run like that in laravel projects ? Like with these steps ?Thanks for answering.
@NeutronDev
Жыл бұрын
The steps are the ones that I went through in this video. You can also check the article as well. The project that I showcased in the video is actually a Laravel project.
@thinyadanarsu8122
Жыл бұрын
@@NeutronDev your reply is so fast. Thank you for answering.
@NeutronDev
Жыл бұрын
No problem! Hope you'll get it done and make the most of it 💪
Can each version log into phpMyAdmin?
@NeutronDev
2 жыл бұрын
Yes
@ibsmiley6313
2 жыл бұрын
@@NeutronDev Thank you.
how can i do that in mac
@NeutronDev
Жыл бұрын
I didn't try XAMPP on macOS but the principles should be the same.
when I changed my php version then I am getting this error 11:01:07 AM [Apache] Error: Apache shutdown unexpectedly. 11:01:07 AM [Apache] This may be due to a blocked port, missing dependencies, 11:01:07 AM [Apache] improper privileges, a crash, or a shutdown by another method. 11:01:07 AM [Apache] Press the Logs button to view error logs and check 11:01:07 AM [Apache] the Windows Event Viewer for more clues 11:01:07 AM [Apache] If you need more help, copy and post this 11:01:07 AM [Apache] entire log window on the forums
@NeutronDev
9 ай бұрын
Hey! Check the logs and see what error you got.
how to switch versions ?
@NeutronDev
Жыл бұрын
What do you mean exactly? If the configs are done correctly, as shown in the tutorial, Apache knows to automatically switch the PHP version when accessing specified domain.
It's not working on my system i have tried alot of time.
@NeutronDev
8 ай бұрын
Oh :( Anything I can help you with?
@user-up7ci5wp4t
8 ай бұрын
@@NeutronDev i preform the same steps provided in tutorial but when i run the project in localhost is show white screen. how to resolve id?
@NeutronDev
8 ай бұрын
The whitescreen is due to an error. Could be anything. Have you checked Apache's logs in XAMPP?
i'm a satisfied camper
@NeutronDev
Ай бұрын
XAMPPER 😂
What with 7.4 version? xD Tried with similar steps, but not working xd
@NeutronDev
Жыл бұрын
Did you download the right php version?
@bssssss63
Жыл бұрын
@@NeutronDev yes, 7.4.9 for win. Whats making problem - GD is not ON. But it is, gd and gd2.
@bssssss63
Жыл бұрын
Also had problem with openssl and curl. But somehow I managed to fix it. But still GD...
@NeutronDev
Жыл бұрын
Do you have the 'gd' & 'gd2' extensions in \xampp\php\ext folder? Are gd & gd2 extensions enabled in php.ini? Remove the ';' in front to enable them.
For linux?
@NeutronDev
Жыл бұрын
What do you mean exactly?
@diatmikapm3683
Жыл бұрын
@@NeutronDev how to multiple php xampp for linux
@NeutronDev
Жыл бұрын
@@diatmikapm3683 I don't have a tutorial for that. Perhaps in the future ^^
@diatmikapm3683
Жыл бұрын
Ok.. Ok... Not problem.. Thanks you..
after this my apachi is not working
@NeutronDev
9 ай бұрын
Check the logs and see what's the issue.
not working
@NeutronDev
7 ай бұрын
What error(s) are you getting?
Please next time you make any video. Zoom your video a little for better view.
@NeutronDev
6 ай бұрын
Yes, already doing that on newer videos ☺
I tried to install php 7.4.0 so made a php740 map. It is only working in my D:/xampp/php740 folder. I want to use 7.4.0 in my D:/xampp/htdocs/symfony1 folder but its not working there. Still getting php v8. I have configured the directory part from the github paste to: UnsetEnv PHPRC php_flag engine off SetHandler application/x-httpd-php740-cgi
@NeutronDev
Жыл бұрын
Hello! Is your script alias within the httpd-xampp.conf file looking like this? # PHP 7.4.0 Set-up ScriptAlias /php740/ "D:/Xampp/php740/" Action application/x-httpd-php740-cgi "/php740/php-cgi.exe" AllowOverride None Options None Require all denied Require all granted SetEnv PHPRC "D:/Xampp/php740" Also, if your Symfony project entry point is in the `/public` folder, make sure to specify that in the statement as shown in the video.
@Pururin_Purin
Жыл бұрын
@@NeutronDev this is what i have right now: # PHP 7.4.0 Set-up ScriptAlias /php740/ "D:/Xampp/php740/" Action application/x-httpd-php740-cgi "/php740/php-cgi.exe" AllowOverride None Options None Require all denied Require all granted SetEnv PHPRC "D:/Xampp/php740" UnsetEnv PHPRC php_flag engine off SetHandler application/x-httpd-php740-cgi When i try enter the command "php -v" in my cmd D:\Xampp\htdocs\symfony1> folder i still get version 8.0.5. I have also setup the enviroment variable.
its just show a white page i already use can you help me please
@NeutronDev
2 ай бұрын
Hey! Sounds like a PHP misconfiguration. Did you check Apache and PHP error logs?
@s7s96
2 ай бұрын
@@NeutronDev There are no errors but nothing works
@NeutronDev
2 ай бұрын
@@s7s96 Does the "original" PHP version still work? Did you download the right Non-Thread Safe/Thread Safe and CPU architecture? You can follow along this article and try to debug: neutrondev.com/multiple-php-versions-in-xampp
Very Helpful, Thank you
@NeutronDev
3 ай бұрын
You're welcome 💜