Как обновить версию php windows 10

I’m trying to get my Laravel project to work. But when I use composer update it says the following:

This package requires php >=5.6.4 but your PHP version (5.5.12) does not satisfy that requirement.

I’m using WAMP which runs php version 7.0.4 this is also confirmed in the browser if I echo the php version. But when I use php -v in the console it shows that I’m using PHP version 5.5.12 (cli).

I’ve searched a bit around on google and I found out that it uses my windows PHP version instead of my webserver’s version. But I couldn’t find out how to update my PHP version on Windows.

My PATH contents are as shown in the following image

enter image description here

worldofjr's user avatar

worldofjr

3,8688 gold badges37 silver badges49 bronze badges

asked Sep 9, 2016 at 17:49

ThomH's user avatar

4

You can uninstall composer, and while re-installing it will ask you to point at your PHP directory which is going to be C:\wamp64\bin\php (usually) at that point you can choose which PHP version you would want to use. good luck.

enter image description here

Jquestions's user avatar

Jquestions

1,6502 gold badges23 silver badges30 bronze badges

answered Oct 27, 2017 at 6:55

Moe Ismail Alhakeem's user avatar

3

This means you have yet another installation of PHP in your system. Check your Programs in Control Panel and remove such installation.

However, you can modify your PATH environment variable as well. Procedure

Just remove the path that points to any PHP installation directory.

Else, otherwise, if you are unsure about changing the PATH variable (which can lead to serious problems if not set well), you can just delete the directory that the PATH variable points to…. (I mean the PHP directory)

The totally better solution is to add the path of your PHP7 bin directory at the beginning of the PATH variable. You should also make available composer in this PHP7 bin directory.

Such as, replace the C:\php in your path with C:\wamp\bin\php7 or whatever the location of the PHP7 path is..

answered Sep 9, 2016 at 17:56

Huzaib Shafi's user avatar

Huzaib ShafiHuzaib Shafi

1,1539 silver badges24 bronze badges

3

To update PHP on Windows 10.

You must put the folder of the new PHP version in the same folder as the old.
You rename the old folder or you delete it, prefer rename the old folder,
now you write in a terminal console

php - v

PHP automatically check for a new version

answered Oct 18, 2020 at 14:27

Julien J's user avatar

1

if you had installed before xampp/wampp and composer globally you might had added php to you environment path to call it where ever you want, and now you want that composer use the new xampp with php the you recently installed, so go to system>advance tab> environment variable> maybe in PATH then search if you have something like C:\xampp\php and edit to your new php location.

I had multiple versions off xampp for testing and composer globaly instaled for php 7.2

hello_world's user avatar

hello_world

7781 gold badge10 silver badges26 bronze badges

answered Jul 20, 2018 at 14:28

alexanderesmar's user avatar

Я пытаюсь заставить мой проект Laravel работать. Но когда я использую обновление композитора, он говорит следующее:

Этот пакет требует php> = 5.6.4, но ваша версия PHP (5.5.12) не удовлетворяет этому требованию.

Я использую WAMP, который запускает версию php 7.0.4, это также подтверждается в браузере, если я повторяю версию php. Но когда я использую php -v в консоли это показывает, что я использую PHP версии 5.5.12 (cli).

Я немного искал в Google и обнаружил, что он использует мою версию PHP для Windows вместо версии моего веб-сервера. Но я не мог узнать, как обновить мою версию PHP на Windows.

Содержимое моего PATH показано на следующем рисунке

введите описание изображения здесь

7

Решение

Вы можете удалить composer, и при переустановке он попросит вас указать каталог PHP, который будет C: \ wamp64 \ bin \ php (обычно), в этот момент вы можете выбрать, какую версию PHP вы хотите использовать. , удачи.

введите описание изображения здесь

8

Другие решения

Это означает, что у вас есть еще одна установка PHP в вашей системе. Проверьте свои Programs в Control Panel и удали такую ​​установку.

Тем не менее, вы можете изменить свой PATH переменная окружения, а также. Процедура

Просто удалите путь, который указывает на любой PHP установочный каталог.

Иначе, если вы не уверены в изменении PATH переменной (которая может привести к серьезным проблемам, если она не установлена ​​правильно), вы можете просто удалить каталог, который PATH переменная указывает на …. (я имею в виду PHP каталог)

Совершенно лучшее решение — добавить путь к вашему PHP7 каталог bin в начале PATH переменная. Вы также должны сделать доступным composer в этом PHP7 каталог bin.

Например, заменить C:\php на вашем пути с C:\wamp\bin\php7 или где бы то ни было PHP7 путь есть ..

1

если вы устанавливали до xampp / wampp и composer глобально, вы могли бы добавить php в путь к своей среде, чтобы вызывать его где угодно, и теперь вы хотите, чтобы composer использовал новый xampp с php недавно установленным вами, поэтому перейдите в system> вкладка «Дополнительно»> переменная окружения> возможно, в «PATH», тогда ищите, если у вас есть C:\xampp\php и отредактируйте к своему новому местоположению php.

У меня было несколько версий от xampp для тестирования и composer globaly для php 7.2

0

Trying to upgrade PHP on windows? We can help you with it.

Here at Bobcares, we have seen several such Windows related queries as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to upgrade PHP on Windows.

How to upgrade PHP on windows

Now let’s take a look at how to upgrade the PHP in Windows.

1. First, make sure that Web Platform Installer is present in IIS. For that, open the Internet Information Systems and click on the server name. If Web Platform Installer is not present then click on the “Get New Web Platform Components”.

2. Now click on the “Install this extension” option on the web browser window that is opened. Then accept the license agreement and follow the prompts to install that Web Platform Installer.

3. Now re-open the IIS and click on the Server Name then Double-Click on the Web Platform Installer.

4. At the top-right of the Web Platform Installer, you can find a Search Window where you need to type “PHP”.

5. Then select the PHP version that you wish to install and click “Add” and “Install”. Also, ensure that you select the 64-bit or 32-bit, depending on the server environment.

6. Finally, now you have successfully upgraded the PHP installation. Then open the command prompt and enter the command iisreset to apply the new settings or you can simply reboot the server to apply the changes.

Selecting and Upgrading PHP on a Plesk server is as simple as selecting the version of your choice from a drop-down menu.

Upgrade PHP on Windows manually

1. First, open the Control Panel >> click on Programs and Features >> Turn Windows features on or off. Under the Internet Information Services, World Wide Web Services, Application Development Features, make sure that option CGI is checked. This will enable both the CGI and FastCGI services, which are recommended for PHP applications.

2. For Windows, download PHP from the below link.

http://windows.php.net/download/

We are using PHP as FastCGI. So we shall use the 64-bit Non-Thread Safe (NTS) version (i.e., php-7.1.1-nts-Win32-VC14-x64.zip).

3. Extract the file php-7.1.1-nts-Win32-VC14-x64.zip to its own folder.

4. Copy current PHP7 installation from v7.0 and rename the copy to v7.1.

5. Then copy all files from the PHP7 zip folder to the new renamed v7.1 folder.

6. Now edit the php.ini (C:\Program Files\PHP\v7.1\php.ini) to reflect the new version (7.1) under [WebPIChanges]:

error_log=C:\WINDOWS\temp\PHP71x64_errors.log
extension_dir=”C:\Program Files\PHP\v7.1\ext\”
;extension=php_mysql.dll
extension=php_mysqli.dll
[PHP_WINCACHE]
extension=php_wincache.dll

MySQL extension was deprecated on PHP version 5.5 and removed on version 7. If it’s not excluded, you’ll see the following error:

PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\Program Files\PHP\v7.1\ext\php_mysql.dll’ – The specified module could not be found.

in Unknown on line 0

7. Now open the IIS Manager and click on FastCGI Settings.

8. Then double-click on the PHP 7.0 settings and copy all the property values including the Environment Variables (PHP_FCGI_MAX_REQUESTS, PHPRC) and Advanced Settings. We are now going to reuse all the values from the existing installation instead of starting from scratch.

Once done, click the Cancel button.

9. Now from the FastCGI Settings window, click on Add Application… on the Actions pane on the right.

10. Then type in C:\Program Files\PHP\v7.1\php-cgi.exe on the Full Path box.

11. Now enter all the values that you have copied from the Steps 8, except for the PHPRC where you want to update the value to 7.1 (i.e., C:\Program Files\PHP\v7.1).

After completion, click on OK.

12. Then go back to IIS Manager and click on Handler Mappings.

13. Search for PHP_via_FastCGI and double-click on it.

14. Now locate the new php-cgi.exe and change the value on the Executable (optional): accordingly. Click Yes when there is a dialog box asking you to create a FastCGI application for this executable.

Finally, click OK and exit the IIS Manager.

[Need any further assistance with Windows queries? – We are here to help you.]

Conclusion

In today’s writeup, we saw how our Support Engineers upgrade PHP on Windows.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Актуальной на сегодняшний момент считается PHP 8.1, которая превосходит в скорости и функциональности все прошлые версии.

  • JIT-компилятор;
  • аннотации и атрибуты;
  • именованные параметры;
  • оператор безопасного null;
  • оператор выбора match.

Здесь все очень просто и прозаично:

Скачиваем последнюю версию PHP

Удаляем старую

Устанавливаем новую.

Прописываем заново настройки в Apache и PHP.

Но прежде чем обновлять, нужно внимательно изучить раздел Appendices в документации к новой версии. В нем описывается устаревший функционал, который больше не применяется в языке. Новые версии не поддерживают старый код: особенно трудна миграция с пятой на седьмую, у которой очень слабая обратная совместимость.

Если разработчик использует неподдерживаемые функции, то кусок кода, в котором они есть, просто не заработает. Поэтому перед обновлением нужно серьезно проанализировать этот раздел и в соответствии с ним — свой код.

Резонный вопрос, которым задаются многие программисты. Если не обновлять язык на собственном сервере, вы просто лишаете себя преимуществ и возможностей очередной версии.

В каждом релизе PHP появляются новые фишки и функции, а также закрываются уязвимости. Например, is_countable позволяет определить тип переменной — перечисляемый или нет. Это очень удобная возможность для веб-разработчиков. Сейчас приходится использовать для определения типа переменной if, а в PHP 8.1 это можно будет сделать одной функцией.

Однако обновление версии PHP — это болезненный процесс для команды разработки, означающий многодневный рефакторинг кода и исправление ошибок — всё из-за проблем с обратной совместимостью в этом языке. Ранее установленные плагины и скрипты могут конфликтовать с новой версией, работать некорректно или не подключаться вообще, добавляя головной боли разработчикам.

Веб-сервис W3Techs провёл опрос и выяснил, какие версии чаще всего используют PHP-разработчики. В начале февраля 2022 года ситуация выглядела вот так:

Статистика использования разных версий PHP

Как видите, самую последнюю версию используют очень немногие. Консервативное большинство остается верным надежным технологиям — от 5 до 7 версий.

Мы скажем так: Святого Грааля в проблеме обновления нет. Подходить к нему нужно с позиции целесообразности. Большой проект перевести на PHP 8 будет сложно: придется рефакторить всю кодовую базу, но ради чего? Любое изменение должно исходить из рабочей потребности.

Если проблем с поддержанием работоспособности сайта и скоростью загрузки нет, то переход на более современную версию — лишняя трата времени и средств. Если разработчикам всего хватает в функционале — в обновлении тоже нет смысла. Переход на новую версию не должен обосновываться тем, что это круто, модно и молодежно.

На старых сайтах, где сплошной легаси, разработчикам вообще страшно что-либо менять, так как велик риск все случайно поломать. Проект стабильно работает, а значит, изменения ни к чему. Зато разработку новых сайтов однозначно нужно начинать с установки последней версии языка.

Photo from Unsplash

Since the release of version 7, PHP has seen steady improvements with a new version released each year.

A PHP version usually gets active support for 2 years and security fixes for one year, which means a version is supported for three years since its initial release.

You can view the versions supported by PHP maintainer in php.net.

This tutorial shows how you can update the PHP version installed on your computer.

Update PHP using Homebrew (Mac)

For Mac computers, you can update the PHP version installed on your computer using Homebrew.

Run the brew upgrade command from the terminal as shown below:

Once the upgrade is completed, check your PHP version using php -v command:

You should see the latest PHP version shown in the terminal.

Update PHP for Linux Ubuntu

If you’re using an Ubuntu computer, you can update the installed PHP by running the following commands:

sudo apt-get update
sudo apt-get install php

Once the installation is finished, you can check the installed PHP version using php -v command:

$ php -v
PHP 8.1.2 (cli) (built: Apr  7 2022 17:46:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

If that doesn’t work, then you need to add the PPA repository created by Ondřej Surý to install the latest PHP version.

To install PPA easily, you need to get software-properties-common installed on your computer:

# 👇 install software-properties-common
sudo apt -y install software-properties-common

# 👇 use add-apt-repository command to install the PPA
sudo add-apt-repository ppa:ondrej/php

# 👇 refresh the package manager
sudo apt-get update

# 👇 install latest PHP version
sudo apt -y install php8.1

At the time of this writing, php8.1 is the latest PHP version. You should update the version to match the latest available PHP version when you follow this guide.

Once the installation is finished, check your PHP version again. You should have the latest PHP version printed on the terminal.

Update PHP for Windows

When you use a Windows computer, you can download a PHP distribution from windows.php.net and install it manually on your computer.

Download and extract the zip file from the website, then replace your existing PHP installation with the one you just downloaded.

Don’t change the folder name because Windows won’t be able to find the PHP folder if you do.

Run php -v from the command line to check your PHP version.

If you don’t want to update PHP manually, you can use the Chocolatey package manager to install and update PHP version for you.

Chocolatey is a package manager for Windows computers, it works like Homebrew for Mac computers.

Install Chocolatey on your computer, then install the PHP package with the following command:

# 👇 install php with Chocolatey
choco install php

# 👇 update php with Chocolatey
choco upgrade php

Once the update process is finished, you should have the latest PHP version available from Chocolatey.

Update PHP version in cPanel

To update the PHP version in cPanel, you need to log into the cPanel system first.

Inside the cPanel, you need to find the Select PHP version menu located in the Software tab:

Click on the menu, then change the Current PHP version option as shown below:

Once you change the PHP version, click the Set as current link that appears beside the version number.

cPanel will work to switch the PHP version and restart your website server.

Please keep in mind that not all web hosting provider provides you with a cPanel.

If you use BlueHost or SiteGround as your web host, you can visit the Update PHP for WordPress guide that I’ve written previously.

There are also several other hosting provider guides that you can find here.

Now you’ve learned how to update PHP version installed on your computer with this tutorial. Good work! 👍

  • Как обновить билд windows 10
  • Как обновить версию java на windows 10
  • Как обновить базовый видеоадаптер майкрософт windows 10
  • Как обновить ватсап на windows 10
  • Как обновить браузер chrome на компьютере windows