Build a PHP development environment under Windows 7
1. Description
The development of all know a word, is "standing on the shoulders of giants." Do now open the browser just a lot of a button to install PHP environment software, such as Wamp, XAMPP, Appserv .... In fact, I have been using Wamp, for beginners is indeed very convenient, a key installation, and then encountered will not go to check, to change the configuration, and so on.
But with long you will find that many of the problems are not so-called "one-click Installation" will not happen! When you use Wamp, Xampp. The environment to build a sense of pro and focus on the implementation of the PHP logic when a lot of bugs are in the environment configuration layer appears, this time you will go back to change, search, search, not worth the candle! I have recently encountered a
Very simple database problems, originally thought that the environment to build on the matter, Apache, MySQL, PHP, installed, configure a bit soon finished! As a result, a large part of the time to solve the problem is wasted on this, so, the environment, that is, Apache, MySQL, PHP, this structure is still need to study seriously, walk slowly does not matter, step by step! Below I, from download to installation step by step, just when you learn, make a record, if can help others is the best!
2. Preparation before installation
#关于apache和php的版本问题
First of all, Apache is now the mainstream of the two version is 2.2 and 2.4, the functional difference is not much to say, the main next and PHP collocation. For apache2.2 can be paired with php5.3.x and php5.4.x version, when choosing PHP to use, you must be aware that the downloaded PHP directory must have "Php5apache2_2.dll" file, because in the configuration Apache "apache2.2\ Conf\httpd.conf "LoadModule in File" LoadModule php5_module "D:/php/php5apache2_2.dll" "must be php5apache2_2.dll, or it will appear" the Requested operation has failed! " The error. For apache2.4, just "LoadModule php5_module" C:/php/php5apache2_4.dll "is 2_4."
The following is the PHP version, http://windows.php.net/download/, you may find the download NTS version and TS version, such as: VC9 x86 Non thread safe VC9 x86 thread safe These two have What's the difference, in simple terms non-thread-safe non-threading Security and IIS collocation environment, Thread-safe thread safety and Apache environment This must be noted, otherwise the wrong version, Apache is unable to start, In addition, in the future the download of the extension library is also nts with TS different version download is to correspond. In addition, the php5.5.x version can only be paired with apache2.4, has not supported 2.2 need attention
#apache下载:
Official website: http://httpd.apache.org/in accordance with their own needs to choose a version, I choose here is 2.2.29, if no special requirements best not to use the latest version, but this is not necessary, generally I use than the latest version of the first, relatively long time, there is a bug has been modified, stable!
1) Click on the download below the entry to jump to another interface
2) GZ and GZ2 are not Windows versions, so we chose other files
3) Download the version you need
#php下载
Official website: http://windows.php.net/download#php-5.4
PHP download relatively easy to find out is not to elaborate on their own up and down can be found, if the actual download can not, only in the domestic site casually search one.
#MySql
Official website: http://www.mysql.com/downloads/
But my net is really slow poor so directly in Baidu search A, here I put the link: http://dlsw.baidu.com/sw-search-sp/soft/ea/12585/mysql_installer_community_ V5.6.21.1_setup.1418020972.msi
3. Installation
#apache安装没什么特殊要求, the next step. Installation path is arbitrary, there is the server infomation interface, as long as the fill in the format of the line content does not matter.
After installing in the browser input http://localhost test, if successful will show "It works!".
#PHP安装 extract it to a directory.
#MySql安装
1) Open the downloaded installation file
2) License agreement window, select the below I accept the License terms, then click Next
3) Choosing a Setup type window, select Custom, then click Next
4) Select products and Features window, click on the left side of the MySQL servers tree interface, choose the corresponding version (X64? X86.), then click the green right arrow, then tap Next
5) Then you can go all the way next, there will be a hint to enter a minimum length of 4-bit password, input on it.
4, W (Windows) A (Apache) m (MySQL) p (PHP) configuration (from http://www.cnblogs.com/pharen/archive/2012/02/06/2340628.html)
Apache: First modify the Apache configuration file, let Apache support parsing php files. Apache configuration files are httpd.conf in the Conf directory of the Apache installation directory.
1. Allow Apache to parse the PHP file and locate it in the configuration file
#LoadModule Vhost_alias_module modules/mod_vhost_alias.so
Add on the next line (the green location 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
Switch
DirectoryIndex index.php index.html
3. Modify the Apache Site Directory, found in the configuration file (Apache installed directory, different values displayed)
DocumentRoot "d:/develop/apache2.2/htdocs"
Switch
DocumentRoot "d:/workspace/php"
Find it again.
<directory "d:/develop/apache2.2/htdocs" >
Switch
<directory "d:/workspace/php" >
PHP: Renamed Php.ini-development to php.ini as a PHP configuration file. Modify PHP.ini
1. Set the specific directory for the PHP expansion pack to find
; On Windows:
; Extension_dir = "ext"
Change to (value is the directory of Ext folder)
; On Windows:
Extension_dir = "d:/develop/php/ext"
2. Turn on the library function to locate the row of the library you want to open
; Extension=php_curl.dll
; Extension=php_gd2.dll
; Extension=php_mbstring.dll
; Extension=php_mysql.dll
; Extension=php_xmlrpc.dll
Remove the preceding semicolon (note) and change to
Extension=php_curl.dll
Extension=php_gd2.dll
Extension=php_mbstring.dll
Extension=php_mysql.dll
Extension=php_xmlrpc.dll
3. Set the time zone to find
;d Ate.timezone =
Switch
Date.timezone = Asia/shanghai
Configuration is complete to detect the success of the configuration. Restart Apache, in the Site directory, create a new file index.php, enter the content:
<?php phpinfo ();?>
Open the browser input http://localhost, display the following content, the installation was successful, and successfully associated with MySQL.
Build the PHP development environment under Windows 7 (manual)