Home  >  Article  >  Backend Development  >  Building a PHP environment under Windows

Building a PHP environment under Windows

WBOY
WBOYOriginal
2016-08-08 09:19:19743browse

Download and configure php

Download php: http://windows.php.net/download/
In this example, the PHP version used is php-5.6.11

1. Processing dll files
Copy all dll files in the php-5.6.11 folder (remember, all dll files in all folders) to the System32 folder of the system, similar to C:WindowsSystem32. Alternatively, you can also specify the system environment variable and add the folder where php5 is located to the PATH variable; however, for simplicity, you can choose to copy the dll file directly to the windows system directory.

2. Rename
Rename php.ini-development under the php-5.6.11 folder to php.ini. php.ini is the configuration file of php5. You can also configure various features of php in php.ini in the future.

3. Configure various features of php
Find a place in php.ini that has a format similar to the following:

;extension=php_bz2.dll

In the above configuration, there is ";" in front of it to indicate that the configuration is invalid, so the ";" before the configuration item should be removed:

extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_intl.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll

like extension=php_gd2.dll means to enable PHP to support the GD2 image library. If you want to enable support for mysql, sqlite, etc., then extension=php_pdo_mysql.dll,
extension=php_pdo_sqlite.dll, extension=php_mysql.dll, etc. must also be turned on

Four. Set the extension support directory

Manually set the extension directory in the php.ini file (just add it directly):

extensi/php/ext ”
Among them, xxx represents the file directory of php

5. Support PHP parsing

Add the following configuration to the apache configuration file httpd.conf:

# Let apache load the php processing module
LoadModule php5_module “xxx/php-5.6.11/php5apache2_4.dll”
#phpinidir This is the ini file used to know php. This file is some configuration of php
PHPIniDir “xxx/php-5.6.11”
#This configuration means that when the extension of a resource is php, it will be processed by php
AddType application/x-httpd-php .php

Among them, xxx represents the folder directory where php-5.6.11 is located. Please specify it according to the actual situation

Test PHP support

In the htdocs folder of the apache server (or other directory, which is the working directory of apache anyway), create a new php file and type the following code:
Building a PHP environment under Windows

Then, save the file as test.php and enter in the browser address bar: http://127.0.0.1// Access test.php or http://localhost/test.php. If the PHP system information comes out, then the PHP environment configuration is successful; otherwise, you made an error in any of the above links. Recheck each link. to complete the configuration.

Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above is an introduction to setting up a PHP environment under Windows, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:HTML5 file upload exampleNext article:HTML5 file upload example