- Upgrade PHP on Windows – Do it with ease
- How to upgrade PHP on windows
- Upgrade PHP on Windows manually
- Conclusion
- PREVENT YOUR SERVER FROM CRASHING!
- Как обновить PHP
- Как обновить PHP сайта и зачем это нужно
- Актуальная версия PHP
- Вот неполный список возможностей PHP 7:
- Как обновить PHP на Windows
- Зачем обновлять, если все работает
- Обновлять или не обновлять: вот в чем вопрос
- How to upgrade php version on Windows 10
- 4 Answers 4
Upgrade PHP on Windows – Do it with ease
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.
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.
Как обновить PHP
PHP мог попасть на компьютер разными способами. Поскольку PHP является портативным, то в простейшем варианте PHP вообще не нужно устанавливать — чтобы запускать скрипты из командной строки, достаточно просто извлечь скаченный архив, и с помощью главного исполнимого php.exe запускать скрипты *.php прямо из командной строки. В этом случае достаточно просто скачать новую версию и распаковать — никакой установки не требуется.
Если у вас PHP в составе какой-либо сборки, то есть смысл проверить новые версии самой сборки, а не обновлять компоненты по отдельности.
Если же вы самостоятельно установили Apache и подключили к нему PHP, то эта инструкция поможет вам обновить PHP до самой последней версии.
Последнюю версию PHP скачайте со страницы https://windows.php.net/download/. Выберите версию Thread Safe, обратите внимание на битность. Если вы затрудняетесь, какой именно файл скачать, то посмотрите эту заметку.
PHP поставляется в виде портативного, автономного пакета, вся настройка которого происходит в файле php.ini. Разве что, можно дополнительно добавить путь до PHP в переменную окружения PATH в Windows. Поэтому после скачивания новой версии, желательно сделать резервную копию php.ini, чтобы не пришлось настраивать заново.
Подразумевается, что у вас установка выполнена в C:\Server\bin\PHP\, если это не так, то здесь и далее подставьте своё значений путей до файлов и папок.
- Прежде всего, скопируйте в безопасное место файл c:\Server\bin\PHP\php.ini.
- Затем удалите папку C:\Server\bin\PHP\.
- Распакуйте новый архив в C:\Server\bin\PHP.
- Скопируйте сохранённый ранее файл php.ini в c:\Server\bin\PHP\php.ini.
Если вы установили PHP для работы в паре с веб-сервером и веб-сервер уже настроен на взаимодействие с PHP, то никакие дополнительные настройки делать не нужно. Достаточно только перезапустить службу Apache, чтобы сделанные изменения сразу вступили в силу:
c:\Server\bin\Apache24\bin\httpd.exe -k restart
Вот и всё — теперь вы можете как запускать файлы скриптов .php с самой последней версией PHP прямо из командной строки, так и работать с последней версией PHP в веб-сервере Apache.
Как обновить PHP сайта и зачем это нужно
Лучшее — враг хорошего? Мы рассмотрели, как обновить версию PHP, на которой работает ваш сайт, и для чего это нужно.
Автор в сфере IT, digital, экономики и финансов. Ведёт некоммерческий проект для начинающих писателей «ЛитЦех».
Актуальная версия PHP
Актуальной на сегодняшний момент считается PHP 8.1, которая превосходит в скорости и функциональности все прошлые версии.
Вот неполный список возможностей PHP 7:
- JIT-компилятор;
- аннотации и атрибуты;
- именованные параметры;
- оператор безопасного null;
- оператор выбора match.
Как обновить PHP на Windows
Здесь все очень просто и прозаично:
Скачиваем последнюю версию PHP
Прописываем заново настройки в Apache и PHP.
Но прежде чем обновлять, нужно внимательно изучить раздел Appendices в документации к новой версии. В нем описывается устаревший функционал, который больше не применяется в языке. Новые версии не поддерживают старый код: особенно трудна миграция с пятой на седьмую, у которой очень слабая обратная совместимость.
Если разработчик использует неподдерживаемые функции, то кусок кода, в котором они есть, просто не заработает. Поэтому перед обновлением нужно серьезно проанализировать этот раздел и в соответствии с ним — свой код.
Зачем обновлять, если все работает
Резонный вопрос, которым задаются многие программисты. Если не обновлять язык на собственном сервере, вы просто лишаете себя преимуществ и возможностей очередной версии.
В каждом релизе PHP появляются новые фишки и функции, а также закрываются уязвимости. Например, is_countable позволяет определить тип переменной — перечисляемый или нет. Это очень удобная возможность для веб-разработчиков. Сейчас приходится использовать для определения типа переменной if, а в PHP 8.1 это можно будет сделать одной функцией.
Однако обновление версии PHP — это болезненный процесс для команды разработки, означающий многодневный рефакторинг кода и исправление ошибок — всё из-за проблем с обратной совместимостью в этом языке. Ранее установленные плагины и скрипты могут конфликтовать с новой версией, работать некорректно или не подключаться вообще, добавляя головной боли разработчикам.
Веб-сервис W3Techs провёл опрос и выяснил, какие версии чаще всего используют PHP-разработчики. В начале февраля 2022 года ситуация выглядела вот так:
Как видите, самую последнюю версию используют очень немногие. Консервативное большинство остается верным надежным технологиям — от 5 до 7 версий.
Обновлять или не обновлять: вот в чем вопрос
Мы скажем так: Святого Грааля в проблеме обновления нет. Подходить к нему нужно с позиции целесообразности. Большой проект перевести на PHP 8 будет сложно: придется рефакторить всю кодовую базу, но ради чего? Любое изменение должно исходить из рабочей потребности.
Если проблем с поддержанием работоспособности сайта и скоростью загрузки нет, то переход на более современную версию — лишняя трата времени и средств. Если разработчикам всего хватает в функционале — в обновлении тоже нет смысла. Переход на новую версию не должен обосновываться тем, что это круто, модно и молодежно.
На старых сайтах, где сплошной легаси , разработчикам вообще страшно что-либо менять, так как велик риск все случайно поломать. Проект стабильно работает, а значит, изменения ни к чему. Зато разработку новых сайтов однозначно нужно начинать с установки последней версии языка.
Читайте также:
How to upgrade php version on 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
This means you have yet another installation of PHP in your system. Check your Programs in Control Panel and remove such installation
PHP CLI and PHP (F)CGI (or even Apache Prefork-MPM) are independent from each other and do not need to use the same PHP version.
4 Answers 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.
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..