Hướng dẫn dùng microsoft.extensions.configuration.ini example trong PHP

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Configuring Step 2: Configure PHP Settings

  • Article
  • 05/14/2020
  • 2 minutes to read

In this article

by Keith Newman and Robert McMurray

In this step of building a PHP website on IIS, you configure the WinCache PHP extension, configure PHP settings, and download and configure any other PHP extensions that your application requires.

When you complete these tasks, continue to Step 3: Configure PHP Application Security.

2.1. Configure WinCache

Before you perform this procedure, you should download in install PHP and WinCache as described in 1.2 Download and Install PHP. For more information about WinCache, see 2.1. Plan WinCache Configuration.

To configure the WinCache PHP extension

  1. In Windows Explorer, open your PHP installation folder, for example C:\PHP.
  2. Choose either the php.ini - development or php.ini - production file, and rename it php.ini.
  3. In a text editor, open the php.ini file and added the following line at the end of the file: extension = php_wincache.dll.
  4. Save and close the php.ini file.
  5. Recycle the IIS Application Pools for PHP to pick up the configuration changes.

To view WinCache configuration and other PHP settings

  1. Open a text editor.

  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 web page is displayed showing the current PHP settings. The WinCache settings appear in a section called wincache.

Warning: Delete the phpinfo.php file when it's no longer needed.

2.2. Configure Other PHP Settings

The following procedure explains how to configure PHP settings in the php.ini file. For more information about PHP settings, see 2.2. Plan other PHP settings.

To configure a PHP setting

  1. In Windows Explorer, open your PHP installation folder, for example C:\PHP.

  2. In a text editor, open the php.ini file.

  3. Search the file for the setting you want to change.

    If the setting is commented out (line begins with a semicolon [;]), delete the semicolon and set the value. If you can't find the setting, add the line to the end of the file.

  4. Save and close the php.ini file.

  5. Recycle the IIS Application Pools for PHP to pick up the configuration changes.

2.3. Configure PHP Extensions

The following procedure shows how to download and install a PHP extension. For information about PHP extensions, see 2.3 Plan PHP Extensions.

To configure a PHP extension

  1. Download the PHP extension you want from the list of Windows extensions for PHP.
  2. Extract the extension zip package to the PHP extensions folder (\ext), for example C:\PHP\ext.
  3. In Windows Explorer, open your PHP installation folder, for example C:\PHP.
  4. In a text editor, open the php.ini file.
  5. Search the file for the extension you want to configure. If the extension is commented out (line begins with a semicolon [;]), delete the semicolon. If you can't find the extension, add it to the end of the file. A line that adds an extension is in the form: extension = extension_name.dll. For example: extension = php_soap.dll.
  6. Save and close the php.ini file.
  7. Recycle the IIS Application Pools for PHP to pick up the configuration changes.

See Also

  • Configure a PHP Website on IIS
  • Step 2: Plan PHP Settings
  • Step 1: Install IIS and PHP
  • Step 3: Configure PHP Application Security
  • Hosting-Friendly Web Server Platform (IIS): Scenario Overview

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

Tải xuống Microsoft Edge Xem thêm thông tin về Internet Explorer và Microsoft Edge

Đọc bằng tiếng Anh

Đọc bằng tiếng Anh Chỉnh sửa

Microsoft.Extensions.Configuration.Ini Namespace

  • Reference

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

In this article

Classes

IniConfigurationProvider

An INI file based ConfigurationProvider. Files are simple line structures (INI Files on Wikipedia).

IniConfigurationSource

Represents an INI file as an IConfigurationSource. Files are simple line structures (INI Files on Wikipedia).

IniStreamConfigurationProvider

An INI file based StreamConfigurationProvider.

IniStreamConfigurationSource

Represents an INI file as an IConfigurationSource. Files are simple line structures (INI Files on Wikipedia).

Trong bài viết này