How to downgrade Wampserver PHP? - php

I see everywhere for downgrade php on wampserver I just have to do left click wamp> php>version> get more>
And dowload the version I want.
But when I do it I arrive on this page and I don't see any link for download an other php version. I only can download a file php5.2.4.isson this page
So fine I dowload it on php.net and I unzip the archive in my folder "C:\wamp\bin\php\php5.2.4"
Next I copy the files wampserver.conf, php.ini and phpForApache.ini from my folder "C:\wamp\bin\php\php5.5.12" to the folder "C:\wamp\bin\php\php5.2.4"
And to finish I change in the file php.ini and phpForApache.ini the path :
extension_dir = "C:\wamp\bin\php\php5.2.4"
When I restart wamp I have the 2 versions of php the one I use actualy (5.5.12) and the one I want to instal (5.2.4) but when I choose the 5.2.4 my wamp icon became orange and stay like this I don't understand why.

To manually install any version of PHP into WAMP you can follow the following steps...
Download the binaries from php.net
Extract all files into a new folder: C:/wamp/php/php5.4.13 (or whatever the version number is)
Copy the wampserver.conf file from another PHP folder in wamp to the new folder.
Rename php.ini-development file to phpForApache.ini
Restart WampServer by exiting out of Wamp and restarting it)
Note: If you are adding php version 5.6, you need to copy php5apache2_4.dll from another php folder in wamp as well otherwise the wamp server wont start.

Visit Wampserver Activities and download the desired PHP version then run the package to install.
Start the wamp server and try again to left-click wamp> PHP> version > select version

I think best and easiest solution is download older version WAMP ,when installing WAMP you can choose what version of php(default they choose latest version, so attention for that,) do you need, that is work for me. for me need to install to php 7.00 so i tried this wamp 3.2 link here
these are the php versions

Related

How to downgrade php from 7.1.1 to 5.6 in xampp 7.1.1?

I want to downgrade php version from 7.1.1 to 5.6 in xampp 7.1.1. But I can't find any option.
I think the most safest downgrade path from PHP7 to PHP5 in Xampp is:
Download a self-packaged version of Xampp with PHP5 from here (as of today this is xampp-win32-5.6.37-0-VC11.zip).
Rename the php folder to php7 in Xampp.
Now copy the php folder from xampp-win32-5.6.37-0-VC11.zip into your Xampp install folder.
Make a backup from .\xampp\apache\conf\extra\httpd-xampp.conf file.
Replace this file from xampp-win32-5.6.37-0-VC11.zip as well.
This way the config files (including php.ini) has settings from the Xampp team.
Before any changes, to verify changed Apache configs, you can compare both Xampp release folder at .\xampp\apache\conf with tools like Meld.
I should note that please download PHP 5 and 7 Xampp packages released at the same time.
Notify me if I miss something.
If you want to downgrade php from 7.1.1 to 5.6 in xampp follow the steps(For Windows):-
Go to https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/5.6.36/
Download and extract the file xampp-win32-5.6.36-0-VC11.zip see the image
[image 1][1]
Delete php folder and apache folder present in C:\xampp
Copy php folder and apache folder from extracted file and paste it to C:\xampp
Add " C: " before \xampp\ to php ini file present in php folder.
Start your apache and MySQL and check php version. It will show php 5.6.36
Just delete this xampp, and download 5.6 version.
There is no option to downgrade XAMPP. XAMPP is hardcoded with specific PHP version to make sure all the modules are compatible and working properly. However if your project needs PHP 5.6, you can just install a older version of XAMPP with PHP 5.6 packaged into it.
Source: How to downgrade php from 5.5 to 5.3
Change the .htaccess code to switch to PHP 5.6:
AddHandler application/x-httpd-php56 .php
XAMPP is an integrated package and you can not downgrade or change one of its component such as php. (There are some solutions that you can use but there is little chances that everything work fine.)
You can download the package from these links:
https://www.apachefriends.org/download.html
https://sourceforge.net/projects/xampp/files/
You had better to download the old package form sourceforge.net.
You do not have to install another version of Xampp. I've managed to use PHP 5.6 on my Xampp PHP 7 version. Here is what you need to do to make it works:
Raname (backup) <XAMPP_DIR>\php to <XAMPP_DIR>\php~7
Copy (backup) <XAMPP_DIR>\apache\conf\extra\httpd-xampp.conf to <XAMPP_DIR>\apache\conf\extra\httpd-xampp~7.conf
Download PHP5 and unpack it to <XAMPP_DIR>\php
Edit <XAMPP_DIR>\apache\conf\extra\httpd-xampp.conf and change all php5 occurrences to php7. You need to change php7apache2_4.dll to php5apache2_4.dll, php7ts.dll to php5ts.dll and php7_module to php5_module
Ensure all your paths are correct like extension_dir in php.ini.
Restart Apache and voila.
If you want to downgrade php version, just simply edit yout .htaccess file.
Like you want to downgrade any php version to 5.6, just add this into .htaccess file
<FilesMatch "\.(php4|php5|php7|php3|php2|php|phtml)$">
etHandler application/x-lsphp56
</FilesMatch>
I know it might be late but I'm just adding to Lanti's answer since it's the most popular, I had the same problem as Wouter Vanherck in the comments and I can't comment yet.
What helped for me was instead of just replacing \xampp\apache\conf\extra\httpd-xampp.conf I replaced the whole apache folder. I basically did the same thing with it as with the php folder (steps 2 and 3).
Now the error is fixed and Apache starts just fine.
Using WAMP is perforce option if we want to use more then one version of php.
It is very easy to do, all you need to do is
1) download 5.6 from [1]: https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/5.6.36/, the run the setup and install in folder "xampp"
2) download 7.6 from [https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/7.4.2/xampp-portable-windows-x64-7.4.2-0-VC15-installer.exe/download][1] and run the setup in "xampp2"
NOte: after that you now have separate xampp installed in your system. all you do now is to run each xampp as a separate entity. Alway quite the 5.6 if you want to run 7.6
This solution is Only for local system / localhost on windows:
The simplest way to install xampp 5.6.X version as per your requirement in other windows drive then run xampp 5.6.X services from it's control panel for php 5.6 version.
NOTE: If you already have xampp (any other version) on your system then please close that xampp's services then start xampp 5.6.x services otherwise this solution will not work.
You can download your required (xampp 5.6 as per question) xampp version from below link:
https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/
I have used this solution many times, it worked like charm. I hope this will also help you. Thank you to ask this question.
i was trying the same, so i downloaded the .7zip version of XAMPP with php 5.6.33 from
https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/5.6.33/
then followed the steps below:
1. rename c:\xampp\php to c:\xampp\php7
2. raname C:\xampp\apache\conf\extra\httpd-xampp.conf to httpd-xampp7.OLD
3. copy php folder from XAMPP_5.6 7zip archive to c:\xampp\
4. copy file httpd-xampp.conf from XAMPP_5.6 7zip archive to C:\xampp\apache\conf\extra\
open xampp control panel and start Apache and then visit ( i am using port 82 instead of default 80)
http://localhost
and then click PHPInfo to see if it is working as expected.
Opening localhost shows dashboard
Opening phpinfo shows version 5.6

Running php 5.x and php 7.0 at the same time in my windows [duplicate]

This question already has answers here:
Is there way to use two PHP versions in XAMPP?
(24 answers)
Closed 3 years ago.
I made a backup file for my php projects then uninstall the old xampp(php 5.x.x). After that, I try to install the latest xampp version(php 7.0.1) and put the backup file from my old xampp to run into the new one including its database. The problem is that, when I try to run my old file I encounter lot of errors. It seems there are lots of code that are obsolete to the new php version. What is the best way to run my old file again ? I think I might reinstall the old xampp but I also want to use the latest php version. What is the ideal thing to do ? I have read some article about it, but I didn't found a clear explanation about this. Please help.
I found a solution to quickly change the version of PHP from 5.6, 7.0 and 7.1 with only one Xampp installation.
I'm currently using it to develop locally with Windows without having problems, the database remains unchanged and also the Apache httpd-vhosts.conf configuration file: this allows the PHP version to be changed quickly and easily.
From the official ApacheFriends website download the latest 3 versions of Xampp (Control Panel 3.2.2) for windows portable version:
xampp-portable-win32-7.1.7-0-VC14.zip
xampp-portable-win32-7.0.21-0-VC14.zip
xampp-portable-win32-5.6.31-0-VC11.zip
Unzip the Xampp win32-7.1.7 version in C:\
Rename the C:\xampp\php folder to C:\xampp\php-7.1.7
From Xampp win32-7.0.21 version
extract the \xampp\php folder to C:\xampp\php
and then rename it to C:\xampp\php-7.0.21
From Xampp win32-5.6.31 version
extract the \xampp\php folder to C:\xampp\php
and then rename it to C:\xampp\php-5.6.31
Go to C:\xampp\apache\conf\extra
and rename the httpd-xampp.conf file in httpd-xampp-php-7.conf
From Xampp win32-5.6.31 version extract the \xampp\apache\conf\extra\httpd-xampp.conf file to C:\xampp\apache\conf\extra\httpd-xampp.conf
and then rename it to httpd-xampp-php-5.conf
In C:\xampp** create a new folder with name "**php-switch" and create 3 .bat files, one for each PHP version that you want to manage.
Here is the code to include in the individual files:
set-php-5.6.bat
#echo off
rmdir C:\xampp\php
mklink /J C:\xampp\php C:\xampp\php-5.6.31
del C:\xampp\apache\conf\extra\httpd-xampp.conf
copy C:\xampp\apache\conf\extra\httpd-xampp-php-5.conf C:\xampp\apache\conf\extra\httpd-xampp.conf
echo The version of PHP 5.6.31 is set
pause
set-php-7.0.bat
#echo off
rmdir C:\xampp\php
mklink /J C:\xampp\php C:\xampp\php-7.0.21
del C:\xampp\apache\conf\extra\httpd-xampp.conf
copy C:\xampp\apache\conf\extra\httpd-xampp-php-7.conf C:\xampp\apache\conf\extra\httpd-xampp.conf
echo The version of PHP 7.0.21 is set
pause
set-php-7.1.bat
#echo off
rmdir C:\xampp\php
mklink /J C:\xampp\php C:\xampp\php-7.1.7
del C:\xampp\apache\conf\extra\httpd-xampp.conf
copy C:\xampp\apache\conf\extra\httpd-xampp-php-7.conf C:\xampp\apache\conf\extra\httpd-xampp.conf
echo The version of PHP 7.1.7 is set
pause
Well, it's time to test if everything works:
- run the .bat file for the PHP version you want to set (eg set-php-7.1.bat)
- start Xampp Control Panel and start Apache
- check the PHP live version locally by going to the http://localhost/dashboard/phpinfo.php page
To change PHP version:
- from Xampp Control Panel stop Apache
- run .bat files to change PHP version (eg set-php-5.6.bat)
- from Xampp Control Panel start Apache
- check the PHP live version locally by going to the http://localhost/dashboard/phpinfo.php page
Considerations:
Compared to installing multiple versions of Xampp in separate folders,
this solution allows to have only one Xampp Control Panel and only change the PHP version while keeping the batabase and any Apache customizations in the C:\xampp\apache\conf\extra\httpd-vhosts.conf file unchanged.
Also, this solution can work with Linux and Mac by simply changing the .bat files (and their commands) to .sh for Linux and .command for Mac files (I personally did not run tests on Linux and Mac, but I expect it to be done without any problems).

How can I install PHP extension libsodium in Wampserver?

I am trying to install the Libsodium PHP extension using PECL, but I have no idea how to get the dll files needed. I want to use it with Wampserver on Windows 7 (64-bit).
Can any one help me?
Here is How I did it.
Download the libsodium from here > For PHP 7.0, For PHP 5.6 And For PHP 5.5 (All x64). #One Important Note, Please download appropriate x86-32 bit or x64-64 bit of this extension matching of your environment from here
Extract the Downloaded file and copy libsodium.dll to wamp->bin->php->php5(x).x.xx Folder
Copy php_libsodium.dll From the extracted File to wamp->bin->php->php5(x).x.xx ->ext
Now Click on the WAMP System tray icon.
Go to PHP-> PHP Settings and Click on the enable dl from the menu of the WampManager from the system tray
Now Add bellow line to php.ini from PHP -> php.ini from the menu of Wampmanager, save and close it
extension=php_libsodium.dll
Now Restart Apache or click Restart All Services from the menu of WampManager
You should now get your php_libsodium in the extensions of the php Up and Running.
:)
**I didn't notice that, this question is 4 months old. I hope You have solved this.
use command prompt :
pecl install libsodium
and go to wamp folder find php.ini in php folder :
append this line: to ini file
extension=libsodium.so
You might be able to achieve this result by running php5enmod libsodium, depending on which webserver you use. Make sure you restart your webserver after installing PECL libsodium
here is good references:
https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-libsodium
You can download the dll files you need here: http://windows.php.net/downloads/pecl/releases/libsodium/1.0.2/
Select the version that corresponds with your PHP version, compiler and architecture. (this can be checked using phpinfo(); on your machine)
Copy php_libsodium.dll to "ext" directory (C:\PHP\ext)
Copy libsodium.dll to root of PHP directory (C:\PHP)
Add extension=php_libsodium.dll to php.ini
restart apache
This worked on a standalone version of PHP running on Windows 7, I see no reason why this shouldn't work on WAMP or XAMP.
Wamp 3.2.0 64-bit
Even though in the past apparently more steps were required (see my comment from 2018), today I installed Wamp 3.2.0 64-bit, and when I got an error about libsodium not working, I was able to easily fix it by:
Wamp tray icon > PHP > PHP Extensions > ensure "sodium" is checked
(Wamp will automatically refresh)
I was pleasantly surprised that is worked!
You can also use https://github.com/paragonie/sodium_compat. You can simply use :
composer require paragonie/sodium_compat

Unable to install php_imagick.dll on wamp

I tried various tutorials online as well steps given on SO answers but nothing worked.
I am using windows 64 bit and m using wamp 2.4 ver and php 5.4.12
I have tried various combinations of Imagemagik and php_imagick.dll but nothing worked
Please help, its very important for to run it
I am getting the following error
I know we can open php.ini directly from wamp icon shown in tray but in my case it was not opening. So i was manually opening it from C:\wamp\bin\php\php5.4.12
But then i realized that we have to make changes in three files to make it work.
That are:
C:\wamp\bin\php\php5.4.12\php.ini
C:\wamp\bin\php\php5.4.12\phpForApache.ini
C:\wamp\bin\apache\apache2.4.9\bin\php.ini
Then I followed the steps given by fsasvari in following link
Download ImageMagick: ImageMagick-6.7.7-5-Q16-windows-dll from here (other versions did not work for me)
Install in C:\imagemagick, on last step check "Add application directory to your system path"
Download Imagick DLL: PHP5.5.x version from http://www.peewit.fr/imagick/ (I have 5.5+ version installed on my localhost
Copy php_imagick.dll to C:\wamp\bin\php\ext
Download PHP 5.5 Thread Safe (TS) x86 version from http://pecl.php.net/package/imagick/3.1.2/windows
Copy CORE_RL_* files to C:\wamp\bin\apache\bin\
Edit php.ini file in C:\wamp\bin\apache\bin\php.ini, add extension=php_imagick.dll line in extensions section
Copy all files from C:\imagemagick\modules\coders and C:\imagemagick\modules\filters to C:\imagemagick to load ImageMagick supported formats
Go to Control Panel -> System -> Advanced Settings -> Environment Variables -> New System Variable -> MAGICK_HOME = C:\imagemagick
Restart Wamp server and check phpinfo() for imagick plugin
If last step does not work, restart Windows
Answer by fsasvari

How to downgrade php from 5.5 to 5.3

Is there a way to downgrade php 5.5 to 5.3 in xampp? I searched on google but every one just tell me to uninstall xampp and install an older version. Could I have php 5.5 downgrade to 5.3 without reinstall xampp?
Short answer is no.
XAMPP is normally built around a specific PHP version to ensure plugins and modules are all compatible and working correctly.
If your project specifically needs PHP 5.3 - the cleanest method is simply reinstalling an older version of XAMPP with PHP 5.3 packaged into it.
XAMPP 1.7.7 was their last update before moving off PHP 5.3.
Long answer: it is possible!
Temporarily rename existing xampp folder
Install xampp 1.7.7 into xampp folder
name
Folder containing just installed 1.7.7 distribution rename to different name and previously existing xampp folder rename back just to xampp.
In xampp folder rename php and apache folders to different names (I propose php_prev and apache_prev) so you can after switch back to them by renaming them back.
Copy apache and php folders from folder with xampp
1.7.7 into xampp directory
In xampp directory comment line apache/conf/httpd.conf:458
#Include "conf/extra/httpd-perl.conf"
In xampp directory do next replaces in files:
php/pci.bat:15
from
"C:\xampp\php\.\php.exe" -f "\xampp\php\pci" -- %*
to
set XAMPPPHPDIR=C:\xampp\php
"%XAMPPPHPDIR%\php.exe" -f "%XAMPPPHPDIR%\pci" -- %*
php/pciconf.bat:15
from
"C:\xampp\php\.\php.exe" -f "\xampp\php\pciconf" -- %*
to
set XAMPPPHPDIR=C:\xampp\php
"%XAMPPPHPDIR%\.\php.exe" -f "%XAMPPPHPDIR%\pciconf" -- %*
php/pear.bat:33
from
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\.\php.exe"
to
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\php.exe"
php/peardev.bat:33
from
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\.\php.exe"
to
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\php.exe"
php/pecl.bat:32
from
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=C:\xampp\php"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\.\php.exe"
to
IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=C:\xampp\php\"
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\xampp\php\php.exe"
php/phar.phar.bat:1
from
%~dp0php.exe %~dp0pharcommand.phar %*
to
"%~dp0php.exe" "%~dp0pharcommand.phar" %*
Enjoy new XAMPP with PHP 5.3
Checked by myself in XAMPP 5.6.31, 7.0.15 & 7.1.1 with XAMPP Control Panel v3.2.2
It is possible! Yes
In many cases, you might want to use XAMPP with a different PHP version than the one that comes preinstalled.
You might do this to get the benefits of a newer version of PHP, or to reproduce bugs using an earlier
version of PHP.
To use a different version of PHP with XAMPP, follow these steps:
Download a binary build of the PHP version that you wish to use from the PHP website, and extract the contents of the compressed
archive file to your XAMPP installation directory (usually, C:\xampp).
Ensure that you give it a different directory name to avoid
overwriting the existing PHP version. For example, in this tutorial,
we’ll call the new directory C:\xampp\php5-6-0. NOTE : Ensure that the
PHP build you download matches the Apache build (VC9 or VC11) in your
XAMPP platform.
Within the new directory, rename the php.ini-development file to php.ini. If you prefer to use production settings, you could instead
rename the php.ini-production file to php.ini.
Edit the httpd-xampp.conf file in the apache\conf\extra\ subdirectory of your XAMPP installation directory. Within this file,
search for all instances of the old PHP directory path and replace
them with the path to the new PHP directory created in Step 1. In
particular, be sure to change the lines
LoadFile "/xampp/php/php5ts.dll"
LoadFile "/xampp/php/libpq.dll"
LoadModule php5_module "/xampp/php/php5apache2_4.dll"
to
LoadFile "/xampp/php5-6-0/php5ts.dll"
LoadFile "/xampp/php5-6-0/libpq.dll"
LoadModule php5_module "/xampp/php5-6-0/php5apache2_4.dll"
NOTE : Remember to adjust the file and directory paths above to reflect
valid paths on your system.
Restart your Apache server through the XAMPP control panel for your changes to take effect. The new version of PHP should now be active.
To verify this, browse to the URL
http://localhost/xampp/phpinfo.php, which displays the output of the
phpinfo() command, and check the version number at the top of the
page.
I did this in my local environment. Wasn't difficult but obviously it was done in "unsupported" way.
To do the downgrade you need just to download php 5.3 from http://php.net/releases/ (zip archive), than go to xampp folder and copy subfolder "php" to e.g. php5.5 (just for backup). Than remove content of the folder php and unzip content of zip archive downloaded from php.net. The next step is to adjust configuration (php.ini) - you can refer to your backed-up version from php 5.5. After that just run xampp control utility - everything should work (at least worked in my local environment). I didn't found any problem with such installation, although I didn't tested this too intensively.
I just used a very simpler way for this and I just put it here if it could help anyone else.
I just had so much data on my database and I didn't want to transfer my whole Database so I just installed an older version of XAMPP with the PHP version that I required in a new directory (example:XAMPP-OLD) then I opened two control panel of 2 different version of XAMPP and start the MYSQL from the Newer version and Start Apache from the older version to use the other version of PHP.
just keep in mind to transfer files to the other XAMPP folder

Categories