Reputation: 4249
I would like to know how you upgrade PHP in Xampp for Windows? I tried to download the latest PHP version from the main PHP site but when I check (phpinfo) I still get that the previous version is still in use.
Upvotes: 213
Views: 551695
Reputation: 6165
Note that it's not recommended to just swap out an older version of PHP in XAMPP to a newer version, as there's the possibility it could introduce problems and incompatibilities due to tools, configurations and codebases that weren't intended to be used together.
Instead, the safe, recommended way to update XAMPP's PHP version is to update it along with the binaries that PHP needs to work with - namely MySQL and PHPMyAdmin - to versions that are compatible with the version of PHP. This way you will also be able to take advantage of the security and speed advantages of updating to newer versions - for example, modern versions of PHPMyAdmin are miles faster and much less buggy than versions that are a few years old.
Unfortunately there is no easy way to update XAMPP, which is bizarre considering how old and mature it is as a project, but the steps below outline the easiest way to do so.
Rename your current, working XAMPP
folder (located at C:\xampp
by default) to XAMPP.old
or something similar to indicate it's the old version.
Download the XAMPP installer for the version of XAMPP/PHP you want (the XAMPP version mirrors the PHP version to make it easier to know which PHP version you're getting), and install it to C:\xampp
.
Go through the install process and feel free to deselect any software you don't need - like Mercury Mail and Tomcat - to prevent them cluttering up your installation, then wait for the install to complete.
Delete the following folders from C:\xampp
and copy and paste their equivalents from C:\xampp.old
:
htdocs
mysql\data
mysql\backup
You've now moved all of your website and database data over from your last installation, so if you didn't customise your XAMPP configuration a lot or don't care about moving your configuration over, you can stop at this stage and you will have a fully-working installation of XAMPP running on your new version of PHP, along with new software that is compatible with it.
Next, you need to copy over the configuration files from your old XAMPP installation at C:\xampp.old
to the new one at C:\xampp
.
First is the php\php.ini
file - this file should not simply be copied over, as it contains configuration options that are very specific to the current PHP installation. If you've made changes to it or you're not sure whether you have, you can use a diff tool like diff --color -y <old php.ini> <new php.ini>
to compare your old php.ini
file with the one you just installed - if you see any lines in red, these are the lines you might need to copy over to your new C:\xampp\php.ini
file, although note that even many of these might be unnecessary - usually they are removed by the developers because they're no longer needed by the newer PHP version.
The remaining configuration files and folders can simply be copied below into the same locations on C:\xampp
, replacing the newer versions:
apache\conf\httpd.conf
apache\conf\ssl.crt
apache\conf\ssl.csr
apache\conf\ssl.key
phpmyadmin\config.inc.php
apache\conf\extra\httpd-vhosts.conf
All of these changes should be pretty safe but it's always a good idea to keep the C:\xampp.old
folder around for a few weeks while you're testing out your new XAMPP server. If it turns out you missed something you can then just copy it over later.
You should now be able to open the XAMPP Control Panel to start the server and confirm that your new versions of Apache and MySQL are working, and visit localhost/phpmyadmin
to confirm that the latest version of PHPMyAdmin has been installed successfully. Finally, run php -v
to confirm that you're on the installed version of PHP.
Upvotes: 3
Reputation: 109
I've updated the PHP to 8 by downloading the files from here. https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/8.0.6/
Uploaded it to the xampp directory by renaming the previous PHP folder to something else. But, then got the following error while starting the apache.
Error: Apache shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums
After that, I've replaced the apache directory as well from the xampp folder with a newer version which I've downloaded, it sorted the issue out.
Got another problem while trying to access the phpmyadmin page, then again renamed the previous phpmyadmin folder from the xampp directory and uploaded the new version from the downloaded files. It's fixed the issue.
Upvotes: 5
Reputation: 55
Note
In order to run apache server after upgradation PHP 7.4.x requires Microsoft Visual C++ Redistributable for Visual Studio 2019 which can be downloaded here under the heading Other Tools and Frameworks. otherwise apache server won't start.
Upvotes: 1
Reputation: 1014
I have upgraded to php7.2 from php5.6
Steps which I followed.
C:\xampp\apache\conf\extra\http-xampp.conf
5.1. Replace
LoadFile "C:/xampp/php/php5ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php5_module "C:/xampp/php/php5apache2_4.dll"
to
LoadFile "C:/xampp/php/php7ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
Upvotes: 19
Reputation: 5045
1) Download new PHP from the official site (better some zip). Old php
directory rename to php_old
and create again php
directory and put there unzipped files.
In php.ini
connect needed modules if you used something that was turned off by default (like Memcached etc.), but doesn't forget to add corresponding .dll
files.
2) In my case, I had to update Apache. So repeat the same steps: download the new package, rename directories, create new apache
directory and put their new files.
Now you can try to restart apache running apache_start.bat
from xampp
folder (better run this bat, than restart apache service from Windows services window, cause in this case in console you'll see all errors if there will be some, including lines in config where you'll have problem). If you updated Apache and run this file, in the list of services you'll see Apache2.2, but in description you can get another version (in my case that was Apache/2.4.7).
In case of Apache update you can get some problems, so mind:
after you replace the whole directory, you may need to configure you apache/conf/httpd.conf
file (copy virtual hosts from old config, set up DocumentRoots, permissions for directories, all paths, extend the list of index files (by default apache has only index.html
so other index files will be just ignored and Apache will just list the site root directory in browser), configure you logs etc.)
connect modules you need (if you used something that was not turned on by default like mod_rewrite etc.)
Upvotes: 2
Reputation: 239
To update with latest PHP version in xampp without losing your htdocs data you need to download the zip file of your desired version of PHP from sourceforge.net, then copy the PHP folder from the extracted file and paste it into your xampp folder.
NOTE: Don't forget to rename the old PHP file folder which already exists.
Then simply edit your php.ini file with the current path to reach the right PHP folder
After that, you need to re-run your xampp.
I found a video on youtube which can help you. how to update php version in xampp
Upvotes: 3
Reputation: 51
There are newer beta versions of Xampp that come with newer PHP upgrades.
you should check at http://www.apachefriends.org
Upvotes: 5
Reputation: 2388
1) Backup your htdocs folder
2) export your databases (follow this tutorial)
3) uninstall xampp
4) install the new version of xampp
5) replace the htdocs folder that you have backed up
6) Import your databases you had exported before
Note: In case you have changed config files like PHP (php.ini), Apache (httpd.conf) or any other, please take back up of those files as well and replace them with newly installed version.
Upvotes: 3
Reputation: 2025
Take a backup of your htdocs and data folder (subfolder of MySQL folder), reinstall upgraded version and replace those folders.
Note: In case you have changed config files like PHP (php.ini), Apache (httpd.conf) or any other, please take back up of those files as well and replace them with newly installed version.
Upvotes: 146
Reputation: 1599
For Upgradation php in Xampp you can follow this steps, Else you can skip these 4 steps and direct install MAMP (for windows as well) from site and here is the direct download link
Step 1: Make backups Before starting, make sure to backup any settings, custom modules and most importantly the htdocs directory, which contains your scripts and page resources. This directory is normally located atC:\xampp\htdocs\
Step 2: Preparation
Download PHP 5.3.0rc2. I use the VC6 build in order to minimise any potential compatibility issues. It is also recommended that you download the latest Windows version of XAMPP. While this is an upgrade guide that shouldwork with previous versions of XAMPP, it is recommended that a fresh copy of the core files is used. Stop any instances of the Apache service that might be running.
Step 3: The upgrade This guide will assume your XAMPP directory is C:\xampp\
Extract the XAMPP archive to a directory of your choosing, I would recommend using the default C:\xampp\ Extract the contents of the PHP archive to C:\xampp\php\, overwriting the contents of this directory with the new files. Open the file C:\xampp\apache\conf\extra\httpd-xampp.conf and ensure the following lines are present in this order:
LoadFile "/xampp/php/php5ts.dll"
LoadModule php5_module "/xampp/apache/bin/php5apache2_2.dll"
Replace C:\xampp\php\php.ini with C:\xampp\php\php.ini-dist
Uncomment the lines:
;extension=php_mbstring.dll
;extension=php_pdo_sqlite.dll
Replace the line
magic_quotes_gpc = On
with
magic_quotes_gpc = Off
Copy all files in the C:\xampp\php\ to C:\xampp\apache\bin\ (do not copy the subdirectories or their contents).
After following the above steps, restart your Apache service (this can be done using C:\xampp\xampp-control.exe or manually through the control panel/command prompt). Your PHPinfo should indicate that the upgrade has been successful. I will update this post if I discover any problems from using this method, or a cleaner (automated) means of performing the upgrade.
Upvotes: 0
Reputation: 1895
phpinfo()
, press ctrl+f, and type thread
to check the value.php
.php
folder to something else.php
) folder in xampp directory.php.ini
file from default/old php
folder (That you renamed) and paste it into the new php
folder.Upvotes: 5
Reputation: 1019
I just upgrade my old XAMPP portable with PHP 5.3.X(Include Mercury & FileZilla & Tomcat) to XAMPP portable with PHP 5.6.X ( Include previous versions ) ...
My way:
max_upload_size
and etc on php.ini and also in /apache/conf/extra/httpd-xampp.conf
D
to drive C
NOTE
On Export database tab on phpmyadmin, select UTF-8 Character and check Disable foreign key checks
checkbox
and on import tab uncheck Enable foreign key checks
.
Upvotes: 3
Reputation: 1354
I needed to update my php from 5.3.8 to 5.3.29. (both Thread Safe) on Windows
Steps I did:
Hope that I covered everything.
Most probably these steps will not work if you change major versions of php, e.g. 5.3.x to 5.4.x, but for minor versions, it should work.
Also, a good way to see what's wrong... start command line and try to start httpd.exe, under xampp/apache/bin from there, it will list errors found.
Upvotes: 14
Reputation: 1484
Simplest method to upgrade PHP
in XAMPP
:
XAMPP
.XAMPP
already installed).PHP
folder from the extracted archive.PHP
folder which is in installed XAMPP
directory. You can backup it like changing the PHP
folder name to PHP-old
or
like PHP-version-number
PHP
folder which you copied from the extracted archive.php.ini
file with your backup folder php.ini
file in case you have changed the default settings earlier.server
.Upvotes: 79
Reputation: 3028
You can go through the following link as it helped me, should work for you as well. http://hype-free.blogspot.com/2007/07/updating-php-in-xampp-for-windows.html
Realizing that my answer helped couple of users, here is the edit from original link:
Edit:
NOTE: there are two directories to be updated with new version of files, namely php
sub-directory and apache/bin
sub-directory, inside XAMPP installation.
Upvotes: 64
Reputation: 94
I don't have enough reputation to comment yet, but, to add to ssharma's answer:
After you copy your htdocs folder to a safe place, just export your databases from PHPmyadmin. Simply go to each of your databases and click on the export tab at the top. Export them as sql (or whatever, really - just remember what you chose). Upgrade your XAMPP installation. Now, in the new version of XAMPP, create the databases that you want to re-insert. Example: you have a database named 'test' that you exported from your old installation, name the new, empty database the same thing. Now, go into 'test' and hit the import button along the top (right next to the export button). Click on choose file, find the sql file that you exported earlier (should be 'test.sql') and import. Your tables and data will be in place.
NOTE: There's an option to export the entire collection of databases (it names the file 127.0.0.1.sql). But, I've never had much luck getting it to import correctly. Do each of your databases separately to ensure it works. I made this post kind of long-winded, but that's because I like to write for the people that don't know exactly what they're doing yet (I, myself, was there not too long ago (all of us were at some point)).
Shorthand version of my answer:
1) Export your databases individually
2) Import into your new installation of XAMPP
Upvotes: 5
Reputation: 161
download your desired version of php binary from http://windows.php.net/download/ website. download Thread Safe binary zip version. Unzip the downloaded version of the PHP in a separate folder. Please make sure that your new php folder name is not "PHP". May be you can use filder name as the version name. For example for php 5.4 you can use php54.
Copy the new php folder into your xampp folder. Now go to yourxampp/apache/conf/extra folder. Open file httpd-xampp.conf from the folder extra. Change the following variables:
Variable PHPINIDir to be / Varaible LoadModule to be //php5apache2_2.dl
Save the file httpd-xampp.conf. Restart your XAMPP apache server. If your server get restarted successfully then your server php version is upgraded.
Upvotes: 9
Reputation: 31
http://www.apachefriends.org/en/xampp-windows.html
In this site you can get
XAMPP Add-Ons
by using this add on you can upgrade the latest versions.
Upvotes: 3
Reputation: 60413
I think you need to actually download and install XAMPP with the desired PHP version. I dont think you can just upgrade the components of XAMPP individually unless there is a facility provided for this within XAMPP itself.
Upvotes: 9