Tektriks

Coding starts here
Home / Blog

How to upgrade php 5.6 to php 7 in XAMPP on Windows

User Alert: Click here to run multiple PHP versions in Windows.

PHP 7.0.0 is released on 3rd Dec. 2015. It comes with more strong features which I listing below –

  • PHP 7 is almost twice as fast as PHP 5.6
  • Low memory usage
  • Introducing null coalescing & Spaceship operator
  • Scalar & Return type declarations
  • Session start with options
  • Anonymous classes and much more.

Find more on at http://php.net/manual/en/migration70.php

As a dedicated PHP developer, you should upgrade or make hands dirty with the new version of php. If you struggled with installing the latest version in XAMPP on your Windows 7, 8 or 10 machine, then you come at right place.

First download latest PHP version from http://windows.php.net/download#php-7.0. Download the VC14 x86 Thread Safe or VC14 x64 Thread Safe deciding upon your Windows version( x86 for 32-bit and x64 for 64-bit ). Next extract the zip file in a folder named php.

Go to your XAMPP installation directory and rename your old php directory with old version prefix like php to php_5_6_14. Now copy & paste the extracted new php folder to here.

Next, open httpd-xampp.conf from XAMPP configuration.
xampp
On PHP-Module setup section, comment these two lines and add the two lines below
#
# PHP-Module setup
#
#LoadFile "D:/xampp/php/php5ts.dll"
#LoadModule php5_module "D:/xampp/php/php5apache2_4.dll"
LoadFile "D:/xampp/php/php7ts.dll"
LoadModule php7_module "D:/xampp/php/php7apache2_4.dll"

That’s it. Restart your XAMPP server and keep coding.
localhost

Photo credit: fullo via VisualHunt.com / CC BY-NC-SA

Subscribe
Notify of
guest
61 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
stu
stu
4 months ago

In my case, this got php7 working (but only after using the x32 version even though I’m on x64), but a series of crashes and errors occurred when trying to run anything, including phpmyadmin crashing. It turns out that my installation, being on another disk, wasn’t defaulting to the xampp installation folder. I needed to do the following: I looked in phpinfo to see where it was looking for php.ini, which was in C:/Windows. So, took the php.ini-development file (from php installation), renamed to php.ini and put it in that folder. Then needed to uncomment some extensions including mbstring Then… Read more »

Nitin
Nitin
5 months ago

file D:/xampp/php/php7ts.dll and D:/xampp/php/php7apache2_4.dll are not found in php7 download for 32 bit OS. Hense throwing error.

vikram jeet singh parmar
Reply to  Nitin
4 months ago

Change the path according to your installation.

jamshid
jamshid
8 months ago

Dose not work for me
after finish all above step it will give me error:
“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”

Kainat
Reply to  jamshid
7 months ago

Had same issue and I know it’s too frustrating.
I was searching over internet and have found a solution on here it helped me and I easily updated the PHP version in XAMPP. Try these methods and I hope it’ll help you too 🙂

Nitin
Nitin
Reply to  jamshid
5 months ago

file D:/xampp/php/php7ts.dll and D:/xampp/php/php7apache2_4.dll are not found in php7 download for 32 bit OS. Hense throwing error.

vikram jeet singh parmar
Reply to  jamshid
4 months ago

Found the solution? please share.

test test test
9 months ago

Dose not work for me
after finish all above step it will give me error:
“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”

arek2@wp.pl
arek2@wp.pl
11 months ago

Does not work. When I run the apache config from cmd i get error:
httpd.exe: Syntax error on line 520 of C:/xampp/apache/conf/httpd.conf: Syntax error on line 17 of C:/xampp/apache/conf/extra/httpd-xampp.conf: Cannot load C:/xampp/php/php7ts.dll into server: %1 is not a valid Win32 application.

Daniel Rios
Daniel Rios
1 year ago

Thanks this worked as Sept 2019

Forhan Noor
1 year ago

For Windows, I believe only x86 version of PHP works. I tried with x64 version, but it was throwing dependency error. It worked for x86.

not_a_cylon
not_a_cylon
1 year ago

I followed the steps above and even downloaded x86 instead of x64, but was running into problems with modules not loading, which boiled down to XAMPP not loading the php.ini file on startup. After several hours of searching, turns out that the httpd-xampp.conf that we’re told to edit also contained the following lines (left out angle brackets due to comment formatting): IfModule php7_module PHPINIDir “C:/xampp/php” /IfModule …which does not get activated if you comment out the php5_module declaration, and thus php.ini does not get loaded. Derp. If you’re seeing module and php.ini problems above, change the IfModule block to point… Read more »

Edward
Edward
2 years ago

Don’t you have to copy the “php.ini” file from the old production (php) folder to the new (php) folder that you pasted in?

طراحی سایت
طراحی سایت
2 years ago

Thx, it works

Tish
Tish
2 years ago

Thanks for the instructions. All seems to work fine on my Windows 7 machine, except one thing. phpinfo() still shows the older php version instead of php 7. I took a look at config files for the xampp installation and couldn’t find anything that looked amiss. Where could phpinfo() be getting version information? Just wondering if I am missing something somewhere that needs to be updated.

I did have to add the error logs folder from the old version to the new, because there was none in 7.

arijit hajra
2 years ago

Port 80 in use by “Unable to open process” with PID 4!
After updating got this error

sekharctc
sekharctc
2 years ago

Hi,
May be you have downloaded the php 7 64 bit, before download please check which version of xampp has been installed in your system.
I had also same issue but I fixed this way, just downloaded the php7 for 32 bit and then this issue has fixed.

Pragya
Pragya
2 years ago

when we update as you said …. before updating we need any backup of database or not??

trackback
2 years ago

[…] How to upgrade php 5.6 to php 7 in XAMPP on Windows […]

AzkaWEB
AzkaWEB
2 years ago

Great tip. Thanks for helping me out.

chinhnm57
chinhnm57
2 years ago

Thanks it works perfect

Aswin
3 years ago

in httpd-xampp.conf file I made below changes including above changes too…. #LoadFile “C:/xampp/php/php5ts.dll” LoadFile “C:/xampp/php/libpq.dll” #LoadModule php5_module “C:/xampp/php/php5apache2_4.dll” LoadFile “D:/xampp/php/php7ts.dll” LoadModule php7_module “D:/xampp/php/php7apache2_4.dll” but still I am not able to start apache in xampp it shows below error 3:08:16 PM [Apache] Error: Apache shutdown unexpectedly. 3:08:16 PM [Apache] This may be due to a blocked port, missing dependencies, 3:08:16 PM [Apache] improper privileges, a crash, or a shutdown by another method. 3:08:16 PM [Apache] Press the Logs button to view error logs and check 3:08:16 PM [Apache] the Windows Event Viewer for more clues 3:08:16 PM [Apache] If you need… Read more »

John Carlo
John Carlo
Reply to  Aswin
2 years ago

any update here?

Colin
Colin
Reply to  Aswin
2 years ago

Not sure if you fixed this, but if you notice the path on yours is the C drive and in the example it is D drive. Change to C drive and it should work.

#LoadFile “C:/xampp/php/php5ts.dll”
LoadFile “C:/xampp/php/libpq.dll”
#LoadModule php5_module “C:/xampp/php/php5apache2_4.dll”

LoadFile “D:/xampp/php/php7ts.dll”
LoadModule php7_module “D:/xampp/php/php7apache2_4.dll”

So it should be:

LoadFile “C:/xampp/php/php7ts.dll”
LoadModule php7_module “C:/xampp/php/php7apache2_4.dll”

soso
soso
Reply to  Aswin
2 years ago

hey brother greetings you manage to give solution to that error.

garima
3 years ago

PHP7 updated successfully but in phpmyadmin below metioned error is coming .
Please help . I am using xampp with version 3.2.1
Deprecation Notice in .librariesphp-gettextstreams.php#48
Methods with the same name as their class will not be constructors in a future version of PHP; StringReader has a deprecated constructor

Backtrace

.librariesphp-gettextgettext.inc#41: require()
.librariesselect_lang.lib.php#471: require_once(.librariesphp-gettextgettext.inc)
.librariescommon.inc.php#564: require(.librariesselect_lang.lib.php)
.error_report.php#8: require_once(.librariescommon.inc.php)

Brian Emilius
Brian Emilius
3 years ago

I followed this guide and it works perfectly, except for PDO. I used the php.ini-development file as my php.ini and uncommented the extention folder line, as well as the relevant PDO drivers (php_pdo_mysql.php), and I verified that the dll files are in the ext folder. I also ran php -m in console, and both PDO and pdo_mysql are loaded modules. Yet, I cannot get any PDO scripts to work. The error I get thrown is “Fatal error: Uncaught PDOException: could not find driver in C:xampphtdocspathtoscript.php(19)” Where line 19 is a simple $dbh = new PDO(mysql params); What am I missing?… Read more »

Joshua.
Joshua.
Reply to  Brian Emilius
3 years ago

Hi, Can you change the slashes to forward slashes?
e.g. “C:xampphtdocspathtoscript.php”
to C:/xampp/htdocs/path/to/script.php”

aspokes
aspokes
Reply to  Brian Emilius
3 years ago

i faced the same problem. Its the ini file that’s not loaded. To solve, open your httpd-xampp.conf file.
Look for
Change to
Restart apache.
It should work now. You can run this
echo $inipath = php_ini_loaded_file();
This will display the path if its loaded.

LukasKane
LukasKane
3 years ago

Thx, it works

Kalle
3 years ago

I dont like WAMP. This has PHP 7.0.12 included and is simpler to install: https://www.mwiede.de/windows-php-webserver/

Guillermo Cordeiro García
Guillermo Cordeiro García
4 years ago

Just make sure you download x86 version and not x64, that is why I was getting errors when updating. Even if your machine is 64 bit.
On http://localhost/dashboard/phpinfo.php you will be able to see what architecture you are using.

P. Ghosh
P. Ghosh
Reply to  Guillermo Cordeiro García
2 years ago

Very important point. Unlike the author says “x64 for 64-bit”, it should be x86 for 64-bit also. Thanks for this.
Very good article otherwise.

vikram jeet singh parmar
Reply to  Guillermo Cordeiro García
4 months ago

even after downloading x86 I get the same error.

Evvy
Evvy
4 years ago

I try to upgrade but I got this error:
Syntax error: Cannot load C:/xampp/php/php7ts.dll into server: The specified module could not be found.

Wilson
4 years ago

Hi, i try to upgrade to php 7 and do your steps.
but i got error like this
Syntax error on line 18 of C:/xampp/apache/conf/extra/httpd-xampp.conf: Cannot load C:/xampp/php/php7ts.dll into server: The specified module could not be found.

Evvy
Evvy
Reply to  Wilson
4 years ago

I encountered the same error.

Wilson
4 years ago

Hi, i try to upgrade to php 7 from php 5.6 (xampp ver 3.2.2) but i got error 1:45:13 PM [Apache] Status change detected: stopped 1:45:13 PM [Apache] Error: Apache shutdown unexpectedly. 1:45:13 PM [Apache] This may be due to a blocked port, missing dependencies, 1:45:13 PM [Apache] improper privileges, a crash, or a shutdown by another method. 1:45:13 PM [Apache] Press the Logs button to view error logs and check 1:45:13 PM [Apache] the Windows Event Viewer for more clues 1:45:13 PM [Apache] If you need more help, copy and post this 1:45:13 PM [Apache] entire log window on… Read more »

Henrik
Henrik
4 years ago

Hi!
Followed all steps aswell as Rade’s comment on changing all php5_module.
Inserted my old php.ini in the new php folder.
Restarted Xampp but error first said something about busy ports and later just “shutdown unexpectedly”.
Not sure what’s not working or if I missed something.
Versions are from 5.5.6 to 7.0.10 – x86 thread safe on win8. Apache 2.4.7.

Changed it all back and restarted to get live sites running again.

Is there anything I likely missed or did wrong? Thanks in advance for any advice / Regards Henrik

Henrik
Henrik
Reply to  Biswajit
4 years ago

No apps running on port 80. However I got it running on a later PHP 5 version, so the issue at hand was solved anyway. Might come back later though for more trials on the 7.

Jim
Jim
4 years ago

Followed instructions and Rade’s comment, but noticed no php.ini file. So, I took copied my old php.ini file into the folder with 7.0. Loaded phpinfo.php file in htdocs directory, but it shows 5.5.11 not 7.0. Not sure where to go from here.

Rade
Rade
4 years ago

Thanks. Working. It should be noted that in httpd-xampp.conf you must rename all instances of:
php5_module to php7_module, there are 5 of them.

enas
enas
4 years ago

i use xampp v 1.7.3
no can get button config what the soluation?

Aditya
4 years ago

Its does not work, it is only try to start but close automatically

javed
javed
Reply to  Aditya
4 years ago

Same problem I’m facing it didn’t work .. same case as yours try to start but close automatically..

FAisal
4 years ago

Not worked.

Fjsb
Fjsb
4 years ago

Is it not necessary copy&paste php.ini?

Aswin Giri
Aswin Giri
4 years ago

Didn’t work for me apache didn’t start. It says Attempting to start Apache app…

61
0
Would love your thoughts, please comment.x
()
x