How to Set Multiple PHP Versions in XAMPP

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there if you're watching this it means you already know what exam is and how to use it you also know that there isn't an out of the box featuring sam that allows you to switch between multiple php versions by the end of this video you are going to find out everything you need to know to install multiple php versions in xampp so let's get started for this video i'm going to use xampp324 which is an older version that comes with php744 additionally i would assume you already have a working version of php in some script files or a project you can use throughout the tutorial alright it's time to download our new php version whenever i want to download a php version i choose this website called windows.php.net i'll leave a link in the show notes let's download the latest version at the time of this recording the latest version is php817 there are a couple of things you have to be aware of here the nts and ts version which stands for non-thread safe and threat safe and the 64 and 86 cpu architecture most pcs nowadays have a 64-bit operating system and base processor but if you're not sure about it you can check out the about your pc section in windows now coming back to non thread safe and thread save versions before downloading any versions i would advise you to check if you have thread safety enabled in your current php installation if you already have a working php file or a project you can go to that script file or inside your public slash index.php and use the php info function if you have thread safety enabled then you should download the php version that doesn't contain nts in its name and of course the opposite if you have non thread safety you should download the version that contains nts in its name if you download the wrong version you may end up having problems with php and php extensions once the download finishes go to exam folder and create a new php folder i will name it php817 [Music] because it will contain php817 version i strongly advise you also use the same folder naming approach to make it easier for you later now open the archive you've just run it and extract everything in this folder in the same folder locate the php dash any development file copy it paste it and rename it to php.ini open the php.ini file and search for extension gear remove the semicolon to activate this option and this is the directory in which the php extensions such as curl ftp and mysql are located next up search for curl and from here you can remove the semicolon for any extensions you'd like such as curl ftp filing for mysql mysqlite and and so on so let's do that now um all right so of course it depends very much on the project and yours may have a different extension dependencies um a quick note about these extensions is that if you're trying to set up a php version lower than 5.6 the name of the extensions would have the suffix php underscore the name of the extension and dot dll so make sure you have the correct name of the extension if you already have a working php version then most probably the windows environment variable is already set for php and you can skip this step to check what version of php you have installed open the command prompt and type in php mine is 744 because this is a default version that comes of the box with xampp additionally to check where php is installed you can use the following command where php and as you can see that is the default folder in example if you don't have any php versions installed but you do have xampp installation press the windows button on your keyboard then go to environment variables then under the system variables go to path and then edit then click new and add the path to your php folder mine is this one click ok ok to check if the environment variable is working close all command prompts and open a new one and type php dash v and if you also want to do a php to see the folder it's fine and if everything looks good it's time to move on to the next section now we have to let apache know that we have a new php version ready to be used go to xampp apache conf extra and open the httpd exam file and anywhere in this file i prefer to do it at the end of it paste this chunk of code this basically tells apache where to find this specific php version if you'll be following the same naming convention as i recommended then replace my php 817 with the php version also this code will be posted in a gist so check it out in the show notes next we have to tell apache that for a certain project we want to use a specific php version in the same file add the following piece of code varian is the name of my project and as before don't forget to update the path and the php version to fit your needs before we try out the new version we have to restart apache for the changes to take effect now we can go back to our index.php file and check out the php for settings and as you can see now we have the php version of 817 and everything is ready to go alright that was it if you want to install any other php versions you can redo all the steps the same way if you like this video stick around this channel because i will post more free resources like this one you can also find me on twitter facebook and instagram where i also share web development and other geeky stuff i was carol and i'll see you in the next one
Info
Channel: Neutron Dev
Views: 37,893
Rating: undefined out of 5
Keywords: #php, #xampp, #windows
Id: iOM2LoOd2KQ
Channel Id: undefined
Length: 8min 17sec (497 seconds)
Published: Wed Jul 20 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.