Home  >  Article  >  Backend Development  >  Graphic tutorial on setting up a php environment (apache+php+mysql) under windows

Graphic tutorial on setting up a php environment (apache+php+mysql) under windows

WBOY
WBOYOriginal
2016-07-25 08:52:33906browse
Tutorials on building a PHP development environment under Windows, methods of building a PHP environment based on apache+php+mysql, very detailed PHP configuration tutorials, friends in need can refer to it. 1. Preparation - Download the required software apache httpd-2.2.22-win32-x86-openssl-0.9.8t.msi php php-5.3.10-win32-vc9-x86.zip mysql mysql-5.5.20-win32.msi

2. Install the software

Install apache: Double-click installation, which is no different from installing other windows software. There are no special regulations when filling in server infomation, as long as the entered information conforms to the format.

After the installation is completed, enter http://localhost in the browser. If it works! is displayed, it means apache is installed successfully.

Install php: Unzip php-5.3.10-win32-vc9-x86.zip to a directory.

Install mysql: Double-click to install. If you need to change the installation directory, select custom in choose setup type

After the installation is complete, start configuring mysql. Just keep all the default options, but it is best to change the default encoding of mysql to utf8, set the password in the modify security settings option, enter the password twice to complete, and finally click execute to complete the configuration.

3. Integrate apache+php+mysql

apache: First modify the apache configuration file so that apache supports parsing php files. The apache configuration file is httpd.conf in the conf directory of the apache installation directory.

1. Let apache parse the php file and find it in the configuration file

#loadmodule vhost_alias_module modules/mod_vhost_alias.so

Add in the next line (the green position is based on the directory where php is located)

loadmodule php5_module "d:/develop/php/php5apache2_2.dll" phpinidir "d:/develop/php" ​addtype application/x-httpd-php .php .html .htm

2. Found in the configuration file

directoryindex index.html

changed to

directoryindex index.phpindex.html

3. Modify the apache site directory and find it in the configuration file (the directory where apache is installed is different, the displayed value is different)

documentroot "d:/develop/apache2.2/htdocs"

changed to

documentroot "d:/workspace/php"

Find again

d:/develop/apache2.2/htdocs">

changed to

d:/workspace/php"> 

php: Rename php.ini-development to php.ini as the php configuration file. Modify php.ini

1. Set the specific directory of the php extension package and find

; on windows: ; extension_dir = "ext"

Change to (the value is the directory of the ext folder)

; on windows: extension_dir = "d:/develop/php/ext"

2. Enable the corresponding library function and find the line where the library needs to be enabled

;extension=php_curl.dll

;extension=php_gd2.dll

;extension=php_mbstring.dll

;extension=php_mysql.dll

;extension=php_xmlrpc.dll

Remove the semicolon (comment) in front and change it to

 extension=php_curl.dll

 extension=php_gd2.dll

 extension=php_mbstring.dll

 extension=php_mysql.dll

 extension=php_xmlrpc.dll

3. Set time zone and find

 ;date.timezone =

Change to

 date.timezone = asia/shanghai

The configuration is completed, check whether the configuration is successful. Restart apache, create a new file index.php in the site directory, and enter the content:

Open the browser and enter http://localhost. If the following content is displayed, the installation is successful and mysql is successfully associated.

In this way, the installation and configuration of apache+php+mysql is completed.


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