Configure php with iis

Использование диспетчера PHP для IIS для установки и настройки PHP

PHP Manager не является продуктом корпорации Майкрософт или не поддерживается.

Установка

На странице Загрузки выберите пакет установки, подходящий для целевого компьютера. Скачайте и запустите установщик, который установит и зарегистрирует двоичные файлы диспетчера PHP в IIS. Обратите внимание, что поддерживаются только iis версии 7.0 и более поздних версий. После завершения установки запустите диспетчер IIS и найдите компонент PHP Manager:

При открытии компонента «Диспетчер PHP» предоставляется обзор конфигурации для установки PHP, зарегистрированной в IIS и активной в настоящее время. Если php не зарегистрирован в IIS, единственным действием, которое можно выполнить, является регистрация новой версии PHP.

Регистрация PHP в IIS

Чтобы зарегистрировать новую версию PHP в IIS, сначала необходимо скачать ZIP-архив с двоичными файлами PHP из http://windows.php.net/ , а затем извлечь файлы из него в папку по своему усмотрению. Обратите внимание, что вы также можете установить PHP с помощью установщика веб-платформы или установщика Windows из http://windows.php.net/ . Диспетчер PHP также можно использовать для управления этими установками PHP.

Щелкните задачу «Зарегистрировать новую версию PHP» и укажите полный путь к расположению исполняемого файла main PHP: php-cgi.exe:

После нажатия кнопки ОК новая версия PHP будет зарегистрирована в IIS и станет активной. Это означает, что все сайты на этом сервере IIS по умолчанию будут использовать эту версию PHP.

Проверка существующих установок PHP и устранение проблем с конфигурацией

Для правильной работы PHP в IIS существует набор рекомендуемых параметров, которые необходимо настроить в IIS и PHP. Диспетчер PHP проверяет правильность настройки всех рекомендуемых параметров. Если некоторые параметры настроены неправильно, можно использовать диспетчер PHP для исправления этих параметров.

Если некоторые параметры конфигурации настроены неправильно, при открытии диспетчера PHP появится предупреждающее сообщение:

Щелкнув ссылку «Просмотреть рекомендации», вы увидите все проблемы с конфигурацией, которые существуют в установке PHP. Вы можете просмотреть описание каждой проблемы и рекомендуемые действия по исправлению. Вы также можете выбрать, какие проблемы конфигурации необходимо исправить:

Переключение между версиями PHP

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

Читайте также:  min-height

Проверка выходных данных phpinfo()

Функция phpinfo() в PHP предоставляет очень подробные сведения обо всех аспектах конфигурации среды выполнения PHP. Чтобы проверка выходные данные phpinfo() в диспетчере PHP, используйте задачу «Проверка phpinfo()«.

Настройка отчетов об ошибках

Диспетчер PHP можно использовать для настройки уровня отчетов об ошибках в PHP. Если службы IIS используются на компьютере разработки, можно использовать подробные отчеты об ошибках, чтобы сразу просмотреть все ошибки, предупреждения и уведомления из приложения PHP. Если служба IIS используется в качестве рабочего сервера, то уровень отчетов об ошибках менее подробный, и ошибки регистрируются в файле журнала, но никогда не передаются в HTTP-клиент.

Настройка ограничений среды выполнения

На странице «Ограничения среды выполнения PHP» можно настроить различные тайм-ауты и ограничения:

Настройка всех параметров PHP

Все существующие параметры PHP можно добавить, удалить и изменить на странице «Параметры PHP«.

Включение или отключение расширений PHP

Расширения PHP можно включить или отключить на странице «Расширения PHP«:

Источник

Configuring Step 1: Install IIS and PHP

In this step of building a PHP website, you install IIS and FastCGI, download and install PHP and the WinCache extension, and upload your PHP application.

When you are done, make sure that IIS and the PHP are installed, and your PHP application has been added to your website. Then go on to Step 2: Configure PHP Settings.

1.1. Install IIS

To install IIS, use the following steps:

To install IIS on Windows Server 2012

  1. On the Start page, click the Server Manager tile, and then click OK.
  2. In Server Manager, select Dashboard, and click Add roles and features.
  3. In the Add Roles and Features Wizard, on the Before You Begin page, click Next.
  4. On the Select Installation Type page, select Role-based or Feature-based Installation and click Next
  5. On the Select Destination Server page, select Select a server from the server pool, select your server, and click Next.
  6. On the Select Server Roles page, select Web Server (IIS), and then click Next.
  7. On the Select Features page, note the preselected features that are installed by default, and then select CGI. This selection also installs FastCGI, which is recommended for PHP applications.
  8. Click Next.
  9. On the Web Server Role (IIS) page, click Next.
  10. On the Select Role Services page, note the preselected role services that are installed by default, and then click Next.
Читайте также:  Add css to parent

To install IIS on Windows 8

  1. On the Start page, type Control Panel, and then click the Control Panel icon in the search results.
  2. In Control Panel, click Programs, and then click Turn Windows features on or off.
  3. In the Windows Features dialog box, click Internet Information Services, note the preselected features that are installed by default, and then select CGI. This selection also installs FastCGI, which is recommended for PHP applications.
  4. Click OK.
  5. To verify that IIS installed successfully, type the following into a web browser: http://localhost You see the default IIS Welcome page.

1.2. Download and Install PHP Manually

The procedures in this section guide you to install PHP Manually:

  • Download PHP and the WinCache extension.
  • Install PHP and WinCache.
  • Add the PHP installation folder to the Path environment variable.
  • Set up a handler mapping for PHP.
  • Add default document entries for PHP.
  • Test your PHP installation.

To keep this procedure simple, install the WinCache extension but do not configure it. You will configure and test WinCache in Step 2: Configure PHP Settings.

To download and install PHP and WinCache

  1. Open your browser to Windows for PHP Download Page and download the PHP non-thread-safe zip package.
  2. Download the WinCache extension from the List of Windows Extensions for PHP.
  3. Extract all files in the PHP .zip package to a folder of your choice, for example C:\PHP\ .
  4. Extract the WinCache .zip package to the PHP extensions folder (\ext), for example C:\PHP\ext . The WinCache .zip package contains one file (Php_wincache.dll).
  5. Open Control Panel, click System and Security, click System, and then click Advanced system settings.
  6. In the System Properties window, select the Advanced tab, and then click Environment Variables.
  7. Under System variables, select Path, and then click Edit.
  8. Add the path to your PHP installation folder to the end of the Variable value, for example ;C:\PHP . Click OK.
  9. Open IIS Manager, select the hostname of your computer in the Connections panel, and then double-click Handler Mappings.
  10. In the Action panel, click Add Module Mapping.
  11. In Request path, type *.php.
  12. From the Module menu, select FastCgiModule.
  13. In the Executable box, type the full path to Php-cgi.exe, for example C:\PHP\Php-cgi.exe .
  14. In Name, type a name for the module mapping, for example FastCGI.
  15. Click OK.
  16. Select the hostname of your computer in the Connections panel, and double-click Default Document.
  17. In the Action panel, click Add. Type Index.php in the Name box, and then click OK.
  18. Click Add again. Type Default.php in the Name box, and then click OK.
Читайте также:  Css set content of element

To test your PHP installation

  1. Open a text editor, for example Notepad, as Administrator.
  2. In a new file, type the following text:
  3. Save the file as C:\inetpub\wwwroot\Phpinfo.php .
  4. Open a browser and enter the following URL: http://localhost/phpinfo.php A nicely formatted webpage is displayed showing the current PHP settings.

1.3. Add Your PHP Application

Once you have IIS and PHP installed, you can add a PHP application to your web server. This section describes how to set up your PHP application on an IIS web server with PHP installed. It does not explain how to develop a PHP application.

To add a PHP web application

  1. Open IIS Manager.
    • For Windows Server 2012, on the Start page click the Server Manager tile, and then click OK. On the Server Manager Dashboard, click the Tools menu, and then click Internet Information Services (IIS) Manager.
    • For Windows 8, on the Start page type Control Panel, and then click the Control Panel icon in the search results. On the Control Panel screen, click System and Security, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
  2. In the Connections pane, right-click the Sites node in the tree, and then click Add Website.
  3. In the Add Website dialog box, type a friendly name for your website in the Site name box.
  4. If you want to select a different application pool than the one listed in the Application Pool box, click Select. In the Select Application Pool dialog box, select an application pool from the Application Pool list and then click OK.
  5. In the Physical path box, type the physical path of the website’s folder, or click the browse button (. ) to navigate the file system to find the folder.
  6. If the physical path that you entered in step 5 is to a remote share, click Connect as to specify credentials that have permission to access the path. If you do not use specific credentials, select the Application user (pass-through authentication) option in the Connect As dialog box.
  7. Select the protocol for the website from the Type list.
  8. The default value in the IP address box is All Unassigned. If you must specify a static IP address for the website, type the IP address in the IP address box.
  9. Type a port number in the Port text box.
  10. Optionally, type a host header name for the website in the Host Header box.
  11. If you do not have to make any changes to the site, and you want the website to be immediately available, select the Start Web site immediately check box.
  12. Click OK.

See also

Источник

Оцените статью