Xampp как изменить версию php

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 ...

Upgrading to PHP 8

It’s not a good idea to just swap out an older version of PHP in XAMPP to a new major version like PHP 8, as there’s the possibility it could introduce lots of potential problems and incompatibilities due to tools, configurations and codebases that weren’t designed to play together.

Instead, it’s a much better idea in the long run to just update to the latest version of XAMPP itself — this will upgrade both PHP and any other binaries that PHP needs to work with, including MySQL and PHPMyAdmin, to versions that are designed to be compatible with PHP 8. This way you also take more complete 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 automatic way to update XAMPP, but it can be accomplished manually with very little effort — simply follow the steps below.


How to update XAMPP to PHP 8 properly

  1. 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.
  2. Download the XAMPP installer for the version of XAMPP/PHP you want (note that the XAMPP versions mirror PHP versions to make it easier to know which PHP version you’re getting), and install it to C:XAMPP
  3. 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 the XAMPP folder

Once the install is finished, copy the following folders from your old installation in C:XAMPP.old to your new installation in C:XAMPP:

mysqldata
mysqlbackup
Any website or project folders you have in htdocs

You’ve now moved all of your important data over from your last installation, so if you didn’t customise your XAMPP installation a lot or don’t care about moving your customisations over, you can stop at this stage and you should have a fully-working installation of XAMPP running on PHP 8.


If you do want to keep any configuration changes you’ve made

We’re gonna be moving over all of the main configuration files from your old XAMPP installation at C:XAMPP.old.

First is the phpphp.ini file — you should not just copy this file 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 git diff --color -y OLDFILE NEWFILE 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 should copy to your C:XAMPPphp.ini file.

The rest of the files can be simply copied over, if you think you’ve made any changes to them.

apachehttpd.conf
apacheconfextrahttpd-ssl.conf
apacheconfextrahttpd-xampp.conf
apacheconfextrahttpd-vhosts.conf

Realistically, these will be the same across XAMPP installations so copying them over anyway shouldn’t hurt anything — but it’s always a good idea to keep around the C:XAMPP.old folder for a few weeks while you’re testing out the new installation.

Finally, if you ever set up SSH on your XAMPP server you can copy the keys in apacheconfssl.key to avoid having to set these up again.

You can now restart your server to 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.

Upgrading to PHP 8

It’s not a good idea to just swap out an older version of PHP in XAMPP to a new major version like PHP 8, as there’s the possibility it could introduce lots of potential problems and incompatibilities due to tools, configurations and codebases that weren’t designed to play together.

Instead, it’s a much better idea in the long run to just update to the latest version of XAMPP itself — this will upgrade both PHP and any other binaries that PHP needs to work with, including MySQL and PHPMyAdmin, to versions that are designed to be compatible with PHP 8. This way you also take more complete 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 automatic way to update XAMPP, but it can be accomplished manually with very little effort — simply follow the steps below.


How to update XAMPP to PHP 8 properly

  1. 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.
  2. Download the XAMPP installer for the version of XAMPP/PHP you want (note that the XAMPP versions mirror PHP versions to make it easier to know which PHP version you’re getting), and install it to C:XAMPP
  3. 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 the XAMPP folder

Once the install is finished, copy the following folders from your old installation in C:XAMPP.old to your new installation in C:XAMPP:

mysqldata
mysqlbackup
Any website or project folders you have in htdocs

You’ve now moved all of your important data over from your last installation, so if you didn’t customise your XAMPP installation a lot or don’t care about moving your customisations over, you can stop at this stage and you should have a fully-working installation of XAMPP running on PHP 8.


If you do want to keep any configuration changes you’ve made

We’re gonna be moving over all of the main configuration files from your old XAMPP installation at C:XAMPP.old.

First is the phpphp.ini file — you should not just copy this file 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 git diff --color -y OLDFILE NEWFILE 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 should copy to your C:XAMPPphp.ini file.

The rest of the files can be simply copied over, if you think you’ve made any changes to them.

apachehttpd.conf
apacheconfextrahttpd-ssl.conf
apacheconfextrahttpd-xampp.conf
apacheconfextrahttpd-vhosts.conf

Realistically, these will be the same across XAMPP installations so copying them over anyway shouldn’t hurt anything — but it’s always a good idea to keep around the C:XAMPP.old folder for a few weeks while you’re testing out the new installation.

Finally, if you ever set up SSH on your XAMPP server you can copy the keys in apacheconfssl.key to avoid having to set these up again.

You can now restart your server to 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.

Updated on January 15, 2023

4 mins read

Do you know that you can update PHP in the XAMPP server within a few minutes? This article tells you how to update PHP for Xampp and composer.

Case:

I was trying to make a new build of Laravel with laravel new project-name but the composer was making it with the old version 8.

As Laravel 9 requires PHP 8, my composer was linked to PHP 7.

So, even after running the composer global update didn’t update the overall packages.

Then, I figured out that it could be the issue of PHP of my xampp with the composer.

3 simple steps to update PHP 7 to PHP 8 in XAMPP:

Note:

Before moving forward make sure to take backup (Optional but just in case if something went wrong).

Download PHP from the latest Xampp:

You can download source code of xampp windows from source forge.

xampp source code

Extract the folder and copy php folder from the latest xampp.

Now, go to your existing xampp folder and rename the current PHP folder to php7 or whatever you want.

Then paste the new php folder in the existing xampp.

That’s it! You have finally put the latest php inside Xampp.

But, the process does not end here.

Let’s move to the next step.

Configure httpd-xampp.conf

Open xampp control panel. Go to the apache config and select httpd-xampp.conf.

httpd-xampp .conf php

Here you need to update the following:

Turn php7 to php 8

update php 7 to php 8

Turn php7_module to php_module

update php in xampp

update php in xampp

how to update php

Save it! Now, if you will try to run apache. It will work fine.

If you go to localhost/dashboard/phpinfo.php, you will see the latest php version.

But, when you try to run composer. It will fail and will give tons of errors.

Let’s move to the final step.

Fix Composer after XAMPP PHP update

Go to xampp control panel, click on apache config and go to php.ini.

php ini

Inside php.ini, set the absolute paths like xamppphp to F:xamppphp

F: (Where you have installed directory of xampp, in my case it’s F)

Find xamppphp inside php.ini and change all paths from relative to absolute.

Click save and then go to the command line.

Type composer you will see the output of Composer instead of errors.

Fix PhpMyAdmin Error

After the above process, if your phpmyadmin is broken then follow the steps mentioned below.

You copied the PHP folder and placed it inside your existing xampp. Just like that, you will need to copy the PhpMyAdmin from the new xampp to your existing one.

But, before that make sure to get the backup of the existing config.inc.php file which is inside PhpMyAdmin in xampp, and then replace the complete folder with the new one.

Now, replace the config.inc.php file with the old one.

fix phpmyadmin error

Re-run your xampp’s Apache and MySQL. After that visit the phpmyadmin dashboard.

The Errors should be gone.

That’s it! In a nutshell, you learned:

  • How to download the source code of xampp
  • How to change php version in xampp
  • How to update PHP7 to PHP8
  • How to fix the composer issue after the update to PHP8.
  • How to fix PhpMyAdmin Error

If you want to become smart in web development make sure to subscribe to our newsletter and don’t forget to share with others.

Update PHP in XAMPP and Composer in 1 minute (2022) Click To Tweet

Slide 1

Most trusted JOB oriented professional program

DevOps Certified Professional (DCP)

Take your first step into the world of DevOps with this course, which will help you to learn about the methodologies and tools used to develop, deploy, and operate high-quality software.

Slide 2

DevOps to DevSecOps – Learn the evolution

DevSecOps Certified Professional (DSOCP)

Learn to automate security into a fast-paced DevOps environment using various open-source tools and scripts.

Slide 2

Get certified in the new tech skill to rule the industry

Site Reliability Engineering (SRE) Certified Professional

A method of measuring and achieving reliability through engineering and operations work – developed by Google to manage services.

Slide 2

Master in DevOps Engineering (MDE)

Get enrolled for the most advanced and only course in the WORLD which can make you an expert and proficient Architect in DevOps, DevSecOps and Site Reliability Engineering (SRE) principles together.

Slide 2

Gain expertise and certified yourself

Azure DevOps Solutions Expert

Learn about the DevOps services available on Azure and how you can use them to make your workflow more efficient.

Slide 3

AWS Certified DevOps Professional

Learn about the DevOps services offered by AWS and how you can use them to make your workflow more efficient.

previous arrow

next arrow

Hey friends i am going to discuss with some common error with xampp. i installed xampp in my pc and working with Laravel version 5.8 and php version 7.1.3 so i face a lot issue when trying to run php artisan commands. so i googled and found so many solution but i solve it in a very simple way. so please look below steps to solve it.

Step 1 : download xampp version 7.1.32 from this url click here
Step 2 : after download extract it and you will see php and apache folder in it.
Step 3 : Rename php and apache folder present in C:xampp
Step 4 : Copy php and apache folder from extract folder and paste it C:xampp
Step 5 : Restart Apache and MySQL and check php version using command “php -v”


References:

Solution 1: Click Here

  • Author
  • Recent Posts

Chandan Kumar

Senior Software Engineer at Cotocus

Email — contact@DevOpsSchool.com

Be a Full Stack Developer and eager to learn new Technology.
Knowledge: CSS, Bootstrap, Javascript, PHP, WordPress, Joomla, Moodle, Laravel, AJAX, Jquery, Java, Dart, Flutter, Photoshop, CorelDraw, Pagemaker
& Office Package

Chandan Kumar

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Xaml error the name does not exist in the namespace
  • Xbox 360 ошибка 0101 ремонт
  • Xbox 360 ошибка 0031
  • Xbox 360 ошибка 0012
  • Xbox 360 ошибка 0011

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии