Установка в системах Windows
Установка PHP в современных операционных системах Microsoft Windows и рекомендуемая конфигурация под распространённые веб-серверы.
Официальные релизы PHP для Windows рекомендованы для использования в промышленной эксплуатации. Однако, вы также можете собрать PHP из исходных кодов. Вам потребуется окружение Visual Studio. Обратитесь к разделу » Пошаговое руководство по сборке для получения более полной информации.
- Использование PHP в командной строке Windows
- Установка PHP на Azure App Services (он же Microsoft Azure, Windows Azure, или (Windows) Azure Web Apps).
User Contributed Notes 12 notes
17 years ago
If you make changes to your PHP.ini file, consider the following.
(I’m running IIS5 on W2K server. I don’t know about 2K3)
PHP will not «take» the changes until the webserver is restarted, and that doesn’t mean through the MMC. Usually folks just reboot. But you can also use the following commands, for a much faster «turnaround». At a command line prompt, type:
and that will stop the webserver service. Then type:
net start w3svc
and that will start the webserver service again. MUCH faster than a reboot, and you can check your changes faster as a result with the old:
in your page somewhere.
I wish I could remember where I read this tip; it isn’t anything I came up with.
17 years ago
You can have multiple versions of PHP running on the same Apache server. I have seen many different solutions pointing at achieving this, but most of them required installing additional instances of Apache, redirecting ports/hosts, etc., which was not satisfying for me.
Finally, I have come up with the simplest solution I’ve seen so far, limited to reconfiguring Apache’s httpd.conf.
My goal is to have PHP5 as the default scripting language for .php files in my DocumentRoot (which is in my case d:/htdocs), and PHP4 for specified DocumentRoot subdirectories.
Here it is (Apache’s httpd.conf contents):
—————————
# replace with your PHP4 directory
ScriptAlias /php4/ «c:/usr/php4/»
# replace with your PHP5 directory
ScriptAlias /php5/ «c:/usr/php5/»
AddType application/x-httpd-php .php
Action application/x-httpd-php «/php5/php-cgi.exe»
# populate this for every directory with PHP4 code
Action application/x-httpd-php «/php4/php.exe»
# directory where your PHP4 php.ini file is located at
SetEnv PHPRC «c:/usr/php4»
# remember to put this section below the above
# directory where your PHP5 php.ini file is located at
SetEnv PHPRC «c:/usr/php5»
—————————
This solution is not limited to having only two parallel versions of PHP. You can play with httpd.conf contents to have as many PHP versions configured as you want.
You can also use multiple php.ini configuration files for the same PHP version (but for different DocumentRoot subfolders), which might be useful in some cases.
Remember to put your php.ini files in directories specified in lines «SetEnv PHPRC. «, and make sure that there’s no php.ini files in other directories (such as c:\windows in Windows).
And finally, as you can see, I run PHP in CGI mode. This has its advantages and limitations. If you have to run PHP as Apache module, then. sorry — you have to use other solution (the best advice as always is: Google it!).
Hope this helps someone.
18 years ago
If you get 404 page not found on Windows/IIS5, have a look at C:\SYSTEM32\INETSRV\URLSCAN
There is a .ini file there that prevents some files from being served by IIS, even if they exist, instead IIS will give a 404. The urlscan logfile (same place) should give you some insight into what parameter is preventing a page from loading, if any.
16 years ago
If you are installing PHP on Vista just go to David Wang’s blog. http://blogs.msdn.com/david.wang/
archive/2006/06/21/HOWTO-Install-and-Run-PHP-on-IIS7-Part-2.aspx
15 years ago
Still Can’t Run PHP Code?
After installing php-5.2.5-win32-installer.msi on my Windows XP2. with IIS5.1 it still didn’t run PHP files.
I eventually found the fix*:
1. Goto Control Panel>System>Advanced>Environmental Variables
2. Add a New System Variable «PHRC» and set its path as «C:\Program Files\PHP»
3. Restart
17 years ago
I made the mistake of setting a ‘wildcard application map’ for PHP on a Windows 2003 / IIS 6.0 / PHP ISAPI installation.
This resulted in «No input file specified» errors whenever I tried to load the default page in my site’s directories. I don’t know why this broke things, but it did.
If anyone has the same problem, this may be the cause.
14 years ago
I installed by Microsoft Installer, manually, whatever I always received de same error from IIS7.
HTTP Error 404.3 — Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
The IIS7 interface is quite diferent and are not all together like IIS6
The 5.3 version have not any of those files: php5stdll, php5isapi.dll. etc.
The installer puts others files in handlers and I decided to use them as substitutes. Nothing done!
After that, I discovered that installer do not install these files within the sites, but in the root default site configuration of IIS7.
So, I copied the root configuration to my site and them it worked (all others procedures were done e.g. copy php.ini to windows folder)
18 years ago
In order to run php scripts with php.exe CGI instead of php4isapi.dll under IIS, following steps can be followed.
i) Add a web service extension for PHP using IIS manager. Choose a web service extension name like ‘PHP’ and add your php.exe path in the ‘file location’ while adding the required file e.g. ‘C:\php\php.exe’ in the Add extension dialog box. Don’t forget to ‘Allow’ the extension file.
ii) Open php.ini file located at %systemroot%. Set the following variables to the shown values.
cgi.force_redirect = 0
cgi.redirect_status_env = ENV_VAR_NAME
iii) In your websites, add Application Mapping for ‘.php’ and set the executable path to your php.exe file path.
You can test whether PHP is running or not and other PHP settings using the following simple PHP script.
Feroz Zahid
ferozzahid [_at_] usa [_dot_] [_com_]
17 years ago
Here’s how to run dual PHP instances with PHP 5.2 and any previous PHP on Windows 2003:
1. Right-click My Computer, go to Advanced tab, and click on Environment Variables.
Add the two installations and their EXT directories to the Path variable. For example, add:
c:\php;c:\php\ext;c:\TMAS\php;c:\tmas\php\ext;
Then, add the newer PHP version’s directory as a variable called PHPRC. For example:
Variable:PHPRC
Value: C:\PHP
Click OK to close the Environment Variables window, and click OK to close System Properties.
2. In registry, under HKEY_LOCAL_MACHINE>SOFTWARE>PHP, add a REG_SZ key called iniFilePath and give it a value
of the directory where the older PHP is installed. For example:
C:\TMAS\PHP
3. In IIS, go to the Web Service Extensions. Add both versions’ ISAPI module separately to the extensions
list, and allow both.
4. In IIS, go to each website utilizing the PHP versions. Set an ISAPI filter if needed. On the Home Directory
tab, click Configuration, and add .php, .php3, .phtml, and any other extensions needed (perhaps .html?) to
be filtered through PHP, and specify the ISAPI module version needed for each website.
You can now run two versions of PHP. This is because the order of where to look for the .ini file changed
between previous PHP versions and PHP 5.2, as documented at http://us2.php.net/ini:
* SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
* The PHPRC environment variable. Before PHP 5.2.0 this was checked after the registry key mentioned below.
* HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry location)
* Current working directory (for CLI)
* The web server’s directory (for SAPI modules), or directory of PHP (otherwise in Windows)
* Windows directory (C:\windows or C:\winnt) (for Windows), or —with-config-file-path compile time option
—————————————————-
15 years ago
IIS setup: 403 forbidden error.
We had installed two separate different PHP versions — PHP 5.1.4 followed by 5.2.5.
We configured 5.2.5 php5isapi.dll to be loaded as the .php file type extension.
Despite this, php version 5.1.4 was being loaded. We renamed 5.1.4’s folder and then PHP was not loading at all.
There were no visible references to 5.1.4 in the IIS configuration, but in the file \webConfig.xml, there was a reference to 5.1.4’s isapi under IISFilters.
To fix this problem, we added version 5.2.5’s php5isapi.dll to the ISAPI Filter category for the web site, in the IIS control panel.
14 years ago
PHP 5.2.9.2 Install on XP Pro IIS 5.1 — phpinfo( ) results incorrect
Testing Date: 05.15.09
Background:
For several days now I, as a newbie, have been unsure if I had installed PHP correctly, or not. No matter what I did phpinfo( ) reported «Configuratin File Path» as: “C:\WINDOWS”. I was left to wonder what was wrong.
To help resolve the phpinfo() “issue”, I conducted a series of tests using two scripts:
The first is “test-php-ini-loaded.php”; it is stored in c:\inetpub\wwwroot, and has the following code:
if ( $inipath ) echo ‘Loaded php.ini: ‘ . $inipath ;
> else echo ‘A php.ini file is not loaded’ ;
>
?>
The second script is simply calls phpinfo( ). It is named test.php, is stored in “c:\inetpub\wwroot”, and has the following code:
My Dev Environment:
1. Windows XP Pro SP3
2. IIS 5.1 / MMC 3.0
3. PHP 5.2.9.2 – phpMyAdmin not yet installed
4. (plus MySQL 5.1, etc.)
5. Install location is on my local E: drive
Test 1:
a. PHPRC environment variable and IniFilePath Registry left in place and active
b. Verified no other copies of php.ini exist on the system other than in my E:\PHP folder
c. Renamed php.ini to hold-php.ini
d. Stopped and started IIS (“net stop iisadmin” and “net start w3svc”)
e. Ran “test-php-ini-loaded.php” to check whether my php.ini is loaded. It is not.
f. Ran «test.php». “Loaded Configuration File” was empty, while “Configuration File (php.ini) Path” showed: C:\WINDOWS.
Test 2:
a. Moved php.ini from E:\PHP to C:\WINDOWS
b. Stopped and started IIS
c. Ran «test-php-ini-loaded.php» to check if my php.ini is loaded. It is not, which surprised me.
d. Ran «test.php». My php.ini is apparently not loaded, or found, by phpinfo( ), even though “Configuration File (php.ini) Path” reports it as being in C:\WINDOWS.
e. Note: Per PHP’s “The configuration file” note, PHP’s search order includes: “Windows directory (C:\windows or C:\winnt) (for Windows), . ”; but it apparently doesn’t or php.ini would have been found and displayed at “Loaded Configuration File”.
Test 3:
a. Left the solo copy of my php.ini in C:\WINDOWS
b. Disabled PHPRC environment variable by renaming it to “Ex-PHPRC and saving the settings (note: for this test I left the Registry entry for PHP IniFilePath intact)
c. Stopped and started IIS
d. Ran «test-php-ini-loaded.php» to check whether my php.ini is loaded. Predictably it is not found.
e. Ran the «test.php». Again, my php.ini file is reported as not found in C:\WINDOWS though “Configuration File (php.ini) Path” reports it as being there.
Test 4:
a. To be thorough and eliminate all possible sources of “mis-direction” I deleted the PHP IniFilePath Registry entry (after backing up the Registry). The PHPRC environment variable was left disabled.
b. Stopped and started IIS
c. Ran «test-php-ini-loaded.php» to check whether my php.ini is loaded. Predictably it is not.
d. Ran «test.php». Again, no change. My php.ini file is not found “Configuration File (php.ini) Path” reports it as being there.
Conclusions:
The first conclusion I came to is that, in the default download version of phpinfo( ), “Configuration File (php.ini) Path” is hard-wired to report C:\WINDOWS whether php.ini is there or not. Further, that C:\WINDOWS is not a default search location (at least not on XP).
However, given an otherwise “proper” setup, phpinfo() reporting C:\WINDOWS as the value for “Configuration File (php.ini) Path” is merely misleading and is not actually harmful or indicative of a failed installation.
Thanks go to Peter Guy of www.peterguy.com who suggested the testing, and to Daniel Brown of www.php.net for some initial guidance.
P.S. This note is not meant to take anything away from PHP. It is a fine tool. The sole purpose of the testing was to confirm that my installation of PHP was correct.
Установка расширений PHP в ОС Windows
После установки PHP и веб-сервера на ОС Windows может понадобиться установить некоторые расширения для добавления функционала. Вы можете выбрать, какие расширения будут загружаться при старте PHP, модификацией вашего файла php.ini . Также вы можете загружать расширения динамически в ваших скриптах, используя функцию dl() .
Библиотеки DLL расширений PHP имеют префикс php_.
Многие расширения встроены в Windows-версию PHP. Это значит, что дополнительные DLL-файлы и директива extension не используются для загрузки данных расширений. Таблица расширений PHP в Windows, содержащая список расширений, требующих (или обычно требующих) дополнительные DLL-файлы. Ниже приведен список встроенных расширений (обновлено PHP 5.0.4): BCMath, Caledar, COM, Ctype, DOM, FTP, LibXML, Iconv, ODBC, PCRE, Session, SimpleXML, SPL, SQLite, WDDX, XML и Zlib.
-
измените опцию extension_dir так, чтобы она указывала на директорию, в которой расположены расширения или в которую вы поместили файлы php_*.dll . Например:
extension_dir = C:\php\extensions
Пример #1 Включение расширения Bzip2 в PHP-Windows
// измените следующую строку с . ;extension=php_bz2.dll // . на extension=php_bz2.dll
Замечание: Если вы запустили PHP в качестве модуля сервера, не забудьте перезагрузить веб-сервер для применения ваших изменений в файле php.ini .
Следующая таблица описывает некоторые доступные расширения и требуемые дополнительные библиотеки dll.
| Расширение | Описание | Примечания |
|---|---|---|
| php_bz2.dll | Функции сжатия bzip2 | — |
| php_calendar.dll | Функции преобразования календарей | — |
| php_crack.dll | Функции Crack | — |
| php_ctype.dll | Семейство функций ctype | — |
| php_curl.dll | Функции библиотеки CURL | Требует библиотеки libeay32.dll , ssleay32.dll (в комплекте дистрибутива PHP) |
| php_dba.dll | DBA: функции абстрактного слоя DataBase (dbm-стиль) | — |
| php_dbase.dll | Функции dBase | — |
| php_dbx.dll | Функции dbx | — |
| php_exif.dll | Функции EXIF | Требуется библиотека php_mbstring.dll. Библиотека php_exif.dll должна загружаться после php_mbstring.dll в файле php.ini . |
| php_fbsql.dll | Функции FrontBase | — |
| php_fdf.dll | FDF: функции формата данных «Forms Data Format» | Требуется библиотека fdftk.dll (в комплекте дистрибутива PHP) |
| php_filepro.dll | Функции filePro | Доступ только для чтения |
| php_ftp.dll | Функции FTP | — |
| php_gd2.dll | Библиотека функций обработки изображений GD | GD2 |
| php_gettext.dll | Функции Gettext | В PHP версий = 4.2.3 требуется библиотека libintl-1.dll и iconv.dll (в комплекте дистрибутива PHP). |
| php_hyperwave.dll | Функции HyperWave | — |
| php_iconv.dll | Функции конвертации кодировок ICONV | Требуется библиотека iconv-1.3.dll (в комплекте дистрибутива PHP), iconv.dll |
| php_ifx.dll | Функции Informix | Требуются библиотеки Informix |
| php_iisfunc.dll | Функции управления IIS | — |
| php_imap.dll | Функции IMAP POP3 и NNTP | — |
| php_ingres.dll | Функции Ingres | Требуются библиотеки Ingres |
| php_interbase.dll | Функции InterBase | Требуется библиотека gds32.dll (в комплекте дистрибутива PHP) |
| php_ldap.dll | Функции LDAP | Требует libeay32.dll , ssleay32.dll (в комплекте дистрибутива PHP) |
| php_mbstring.dll | Функции для работы с многобайтовыми (Multi-Byte) строками | — |
| php_mcrypt.dll | Функции кодирования Mcrypt | Требуется библиотека libmcrypt.dll |
| php_mhash.dll | Функции Mhash | Требуется библиотека libmhash.dll (в комплекте дистрибутива PHP) |
| php_mime_magic.dll | Функции Mimetype | Требуется файл magic.mime (в комплекте дистрибутива PHP) |
| php_ming.dll | Функции Ming для Flash | — |
| php_msql.dll | Функции mSQL | Требуется библиотека msql.dll (в комплекте дистрибутива PHP) |
| php_mssql.dll | Функции MSSQL | Требуется библиотека ntwdblib.dll (в комплекте дистрибутива PHP) |
| php_mysql.dll | Функции MySQL | Требуется библиотека libmysql.dll (в комплекте дистрибутива PHP) |
| php_mysqli.dll | Функции MySQLi | Требуется библиотека libmysql.dll ( libmysqli.dll в PHP версий |
| php_oci8.dll | Функции Oracle 8 | Требуются клиентские библиотеки Oracle 8.1+ |
| php_openssl.dll | Функции OpenSSL | Требуется библиотека libeay32.dll (в комплекте дистрибутива PHP) |
| php_pdf.dll | Функции PDF | — |
| php_pgsql.dll | Функции PostgreSQL | — |
| php_shmop.dll | Функции для работы с разделяемой памятью | — |
| php_snmp.dll | Функции для использования протокола SNMP | Только на Windows NT! |
| php_soap.dll | Функции SOAP | — |
| php_sockets.dll | Функции для работы с сокетами | — |
| php_sybase_ct.dll | Функции Sybase | Требуются клиентские библиотеки Sybase |
| php_tidy.dll | Функции Tidy | — |
| php_tokenizer.dll | Функции Tokenizer | — |
| php_w32api.dll | Функции W32api | — |
| php_xmlrpc.dll | Функции XML-RPC | Требуется библиотека iconv.dll (в комплекте дистрибутива PHP) |
| php_xslt.dll | Функции XSLT | Требуются библиотеки sablot.dll , expat.dll , iconv.dll (в комплекте дистрибутива PHP). |
| php_yaz.dll | Функции YAZ | Требуется библиотека yaz.dll (в комплекте дистрибутива PHP) |
| php_zip.dll | Функции для работы с файлами Zip | Доступ только для чтения |
| php_zlib.dll | Функции сжатия ZLib | — |
Карта сайта
Установка и настройка веб-сервера Apache на Windows
- Установка веб-сервера (Apache 2.4, MySQL 8.0, PHP 7, phpMyAdmin) на Windows 10 – пошаговая, очень детальная инструкция установки веб-сервера в Windows. Также раскрыты вопросы подключения других необходимых компонентов.
- Как установить WordPress в Windows – вы можете тестировать ваши сайты, либо разрабатывать плагины и темы для WordPress прямо на своём компьютере с Windows.
- Настройка Apache в Windows – в этой статье говориться о настройке виртуальных хостов, настройке SSL, резервном копировании баз данных и других вопросах.
- Контроль доступа к сайту (блокировка по IP, User-Agent) – всё о том, как заблокировать доступ к серверу по IP или разрешить доступ только определённым IP адресам.
- Как веб-сервер на своём компьютере сделать доступным для других – попробуйте сделать из своего компьютера самый настоящий сервер!
- Полное руководство по mod_rewrite – подробный, но простой учебник по mod_rewrite с большим количеством примеров!
- Логи Apache (ч. 1): Виды и модули журналов. Формат логов доступа Apache
- Логи Apache (ч. 2): Формат логов ошибок. Журнал событий модулей
- Как защитить веб-сервер Apache от взлома в Windows
- Инструкция по установке веб-сервера Apache c PHP, MariaDB и phpMyAdmin в Windows. Настройка безопасности локального веб-сервера
- Как запустить PHP скрипт без веб-сервера
- Регулярные выражения в PHP (ч. 1)
- Регулярные выражения в PHP (ч. 2)
Статьи по разделам
- Рубрика: Без рубрики
- Как в скрипте Python получить данные от веб-страницы методами GET и POST в Windows
- mysqldump в PowerShell портит нелатинские символы при экспорте базы данных (РЕШЕНО)
- Как сделать резервную копию баз данных MySQL (MariaDB) в Windows без phpMyAdmin
- Окно Apache появляется и сразу пропадает (РЕШЕНО)
- Ошибка «Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: mysqli, openssl» (РЕШЕНО)
- Как исправить «Configuration File (php.ini) Path» no value
- Как запустить PHP скрипт в командной строке (без веб-сервера)
- Как в phpMyAdmin поменять настройки экспорта по умолчанию
- Модуль Apache mod_alias
- Что означают статусы модулей Apache
- Как защитить папку Apache паролем в Windows
- Удалённый просмотр и поиск по логам Apache в Windows (модуль mod_view)
- Как ограничить пропускную способность Apache на Windows для IP и отдельных файлов
- Как в Apache под Windows настроить автоматическую ротацию и очистку логов
- Как сбросить пароль root MySQL или MariaDB в Windows
- Для чего нужна и как использовать open_basedir
- localhost
- Как установить веб-сервер Apache с PHP, MySQL и phpMyAdmin на Windows
- Как и какие функции отключить в PHP
- Как изменить количество цифр после запятой в PHP. Как увеличить точность вычислений в PHP
- Почему не работают короткие теги в PHP
- Что делать если PHP скрипту не хватает времени и памяти. Почему большой файл не загружается на сайт или в phpMyAdmin
- Почему в логах ошибок Apache не сохраняются записи об ошибке 404
- Как установить MariaDB 7.4 в Windows
- Виртуальный хост Apache по умолчанию. _default_ и catch-all в Apache
- Как тестировать отправку писем в PHP на Windows
- Настройка веб-сервера Apache для запуска программ Ruby на Windows
- Настройка веб-сервера Apache для запуска программ Perl на Windows
- Как настроить веб-сервер Apache на запуск Python в Windows
- $ и SRVROOT
- Как проверить конфигурационный файл Apache
- Как запустить два экземпляра Apache
- Как в Windows поменять сообщения ошибок Apache
- Как настроить PHP для работы с get_browser (browscap.ini) в Windows
- Ошибки при настройке и установке Apache, PHP, MySQL/MariaDB, phpMyAdmin
- Как обновить MariaDB в Windows
- Как обновить phpMyAdmin
- Как обновить MySQL
- Как обновить PHP
- Виртуальные хосты Apache
- Ошибка «You’re speaking plain HTTP to an SSL-enabled server port» (РЕШЕНО)
- Apache log (логи): как настроить и анализировать журналы веб-сервера
- Файл .htaccess в Apache
- Apache SSL: переход Apache на HTTPS
- Как обновить Apache на Windows
- Как узнать путь до конфигурационного файла Apache
- Apache Forwarding — проброска портов веб-сервера
- Как установить ownCloud сервер в Windows
- Модули Apache mods
- Как добавить путь до PHP в переменную окружения PATH в Windows
- Готовая сборка Apache для Windows XP
- Как в Windows подключиться к MySQL в командной строке
- MariaDB для Windows
- Как включить mod_rewrite в Windows
- Как запустить Apache не на 80 порту
- Решение проблемы «AH00369: Failed to open the Windows service manager, perhaps you forgot to log in as Adminstrator?»
- Для чего нужен веб-сервер Apache
- Несколько сайтов на Apache
- Установка Apache, PHP, MySQL и phpMyAdmin на Windows XP
- Как подключить MySQL к Apache на Windows
- Как подключить PHP к Apache на Windows
- Документация по Apache на русском языке
- Как запустить Apache на Windows
- Apache для Windows
Свежие записи
- Как в скрипте Python получить данные от веб-страницы методами GET и POST в Windows
- mysqldump в PowerShell портит нелатинские символы при экспорте базы данных (РЕШЕНО)
- Как сделать резервную копию баз данных MySQL (MariaDB) в Windows без phpMyAdmin
- Окно Apache появляется и сразу пропадает (РЕШЕНО)
- Ошибка «Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: mysqli, openssl» (РЕШЕНО)
- Как исправить «Configuration File (php.ini) Path» no value
- Как запустить PHP скрипт в командной строке (без веб-сервера)
- Как в phpMyAdmin поменять настройки экспорта по умолчанию
- Модуль Apache mod_alias
- Что означают статусы модулей Apache
Свежие комментарии
- Дмитрий к записи Как установить веб-сервер Apache с PHP, MySQL и phpMyAdmin на Windows
- apachelounge к записи Как настроить веб-сервер Apache на запуск Python в Windows
- Морозов Кирилл к записи Как настроить веб-сервер Apache на запуск Python в Windows
- apachelounge к записи Как запустить Apache на Windows
- Алексей к записи Как запустить Apache на Windows
Как установить PHP на Windows Server 2012 R2
PHP — это популярный язык программирования, который широко используется для разработки веб-приложений. Установка PHP на ваш сервер Windows Server 2012 R2 может показаться сложной задачей для начинающих, но на самом деле это довольно просто.
В этой пошаговой инструкции мы рассмотрим основные этапы установки PHP на Windows Server 2012 R2. Мы покажем вам, как скачать необходимые файлы, настроить окружение и проверить, что PHP работает должным образом.
Прежде чем мы начнем, убедитесь, что ваш сервер Windows Server 2012 R2 уже настроен и работает без проблем. Также убедитесь, что у вас есть права администратора, чтобы выполнить необходимые действия.
Готовы начать? Продолжайте чтение, чтобы узнать все подробности о том, как установить PHP на Windows Server 2012 R2.
Установка PHP на Windows Server 2012 R2:
Шаг 1: Загрузка дистрибутива PHP
Перейдите на официальный сайт PHP по адресу php.net и найдите раздел загрузок. Скачайте дистрибутив PHP для Windows.
Шаг 2: Распаковка архива
Распакуйте скачанный архив с PHP в нужную вам папку на сервере. Например, C:\php.
Шаг 3: Настройка конфигурации PHP
Переименуйте файл php.ini-development в php.ini. Откройте его в текстовом редакторе.
Шаг 4: Настройка расширений PHP
Раскомментируйте строки, начинающиеся с extension=, чтобы включить необходимые расширения PHP.
Шаг 5: Настройка пути к PHP в системе
Добавьте путь к папке PHP в переменную среды PATH на вашем сервере, чтобы Windows могла найти исполняемые файлы PHP.
Шаг 6: Перезапуск веб-сервера
Перезапустите службу веб-сервера, чтобы изменения в настройках PHP вступили в силу.
Шаг 7: Проверка установки PHP
Создайте простой PHP-скрипт и разместите его на сервере. Откройте скрипт в веб-браузере, и если вы видите его вывод, то PHP успешно установлен на Windows Server 2012 R2.
