When are we going to develop web applications recently or rather in the last (few) years since the emergence of PHP 7, life has become a little more complicated for developers since PHP 5 is in force, in its versions 5.6, 5.7 onwards , then there is a framework, CMD or other systems in PHP that work with one version or another of PHP; For example, the older versions of Codeigniter work with PHP version 5, with PHP 7 they do not work, on the contrary Laravel works with PHP version 7.1 onwards and therefore the PHP 5 version does not work to work with this framework; This is to comment on some particular cases, but there are many more.
As you can imagine, all this brings us more complications since we have to see how we can work with various versions of PHp that sometimes and in certain cases even working with one of the many versions of PHP 5 brings us problems; here we can do several things; Having already installed our Web server in Windows, WAMPP or another similar web server, we can download the PHP versions that we want and copy them to the directories and then we go to httpd.conf and copy a line similar to this:
LoadModule php7_module c:\php7\libphp7.so
So, to vary from one web version to another we have to make this change or switch ourselves manually:
Usar PHP 5:
LoadModule php5_module c:\php5\libphp5.so
#LoadModule php7_module c:\php7\libphp7.so
Usar PHP 7:
#LoadModule php5_module c:\php5\libphp5.so
LoadModule php7_module c:\php7\libphp7.so
Which is somewhat annoying but it can work for us; The other option that we have is to install multiple versions of XAMPP or what we use for web servers in different directories of course and have everything double, which is a more automated solution but more "ugly" when having the same app installed multiple times.
UwAmp to have several instances of PHP installed on our PC
I recently found a web server that helps a lot in this process of having two or more versions of PHP installed on our web server, of course this comes as a replacement for XAMPP since it offers us the same thing, but the possibility of going from one version of PHP to another. another through a selection field; that easy.
UwAmp is Ideal to go from PHP5 to PHP7 without problems, without installing multiple instances of WAMPP, XAMPP or another similar web server and without the need to copy multiple PHP instances to our web server and change them manually; We simply have to change the version from the same interface of the web server that offers us:
To download the web server that we are mentioning, we go to UwAmp, we install it as everything in Windows (next, next, next...) and we are ready to use it
Activate mod_rewrite in UwAmp
The mod_rewrite is a mode that is available in Apache that helps us to create dynamic URLs that in other words are the clean SEO friendly URLs that we use in our applications and that we configure in our .htacces to do multiple operations; For example, it is the one used by CodeIgniter to clean our URLs and that you should know how to activate said module in UwAmp; the first thing to do is go to the Apache httpd.conf configuration file at:
C:\UwAmp\bin\apache\conf\httpd.conf
Or where you have installed the UwAmp and uncomment the following module:
LoadModule rewrite_module "C:/UwAmp/bin/apache/modules/mod_rewrite.so"
To:
#LoadModule rewrite_module "C:/UwAmp/bin/apache/modules/mod_rewrite.so"
And we add the following line; where are the tags VirtualHost
:
<Directory "C:\UwAmp\www">
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo Options
Order allow,deny
allow from all
</Directory>
And with this we have our web server ready to start working:
Install various versions of PHP on the web server way 1
We have two ways to do it, we can go to the official site and download the version of PHP that we want in Download PHP; We select the version we want, unzip it and then copy it to:
C:\UwAmp\bin\php
Then we probably have to add the module in our httpd.conf to make it work in case the software doesn't do it for us.
Install various versions of PHP on the web server form 2
The other option that we have that is much more automated is to use the repositories that UwAmp brings; by clicking on this little icon:
And then we see the list of them and select the one we want to download and install:
Install various versions of MySQL on the web server
To download MySQL we have to go to the official website Download MySQL Community Server and download it, it will probably ask us to log in and indicate why we want to use the famous MySQL database; finally we do a step similar to the previous one:
C:\UwAmp\bin\database
Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter