Pre-Installation Preparation:
1.apache2.2.2
2.php5.2.17
3.sqlserver2008
4.sqlncli.msi (SQL Server client, can go to the Microsoft Official website to download)
5. Ntwdblib.dll (2000.80.194.0)
6.sqlsrv20.exe, Microsoftdriver 2.0 for PHP for SQL Server (SQL Server 2005 And 2008 using SQLSRV20.exe, SQL Server 2010 uses SQLSRV30.exe) (where Php_pdo_sqlsrv_52_ts_vc6.dll and Php_sqlsrv_52_ts_vc6.dll are required) Where 52 indicates that PHP5.3,TS represents thread safety, NTS represents php5.2,53 security, VC6 is compiled with VC6 (VS2005), Vc9 is compiled with VS2008, VC6 applies to IIS.
To begin the installation:
The installation of Apache
1-click APAHCE installation Package
2 Acceptance Agreement
3 The following 3 items can be easily filled out Apache listening to 80 ports. If IIS uses 80 ports, modify the IIS port or the Apache port to avoid conflict
(If this machine test can fill in 127.0.0.1)
4 The default here is typical, we recommend that you choose Custom, click Next.
5 You can modify the installation path here, note that the installation path can not contain Chinese.
6 Click Install Start installation
7 after the installation is completed in the browser to enter http://localhost or http://127.0.0.1 if you can see this page, prove that Apache installation is successful, can explain the static page
installation of SQL Server 2008 (http://www.jb51.net/article/30243.htm)
Installation of PHP
Because PHP is a zip file (not install version), the installation is easier to extract the line. Rename the extracted php-5.2.17-win32 to PHP5 and copy it to the C disk directory. That is, the installation path is C:\PHP5
1 Locate the php.ini.recommended (or php.ini-dist) file in the PHP directory, rename it to php.ini and copy it to the Windows directory of the system disk (for example, C:\Windows).
2 and then the PHP directory under the Php5ts.dll, Php_mssql.dll copied to the directory C:\Windows\System32.
3 Copy the Php_gd2.dll,php_mssql.dll,php_mbstring.dll file under the Php5\ext directory under C:\Windows\System32 if it is not loaded php_gd2.dll PHP will not be able to process the image. Php_mbstring.dll supports wide characters when using phpMyAdmin later
Configure PHP and Associate
SQL Server 2008
Open C:\windows\php.ini File
1 Set extended path lookup Extension_dir has such a line of Extension_dir = "./" Change this row to Extension_dir = "C:\php5\ext" where C:\php5 is the path where you install PHP. Incorrect path will not load DL L (Note: some PHP versions are; extension_dir = "./" To remove the preceding semicolon)
2 separate search, Extension=php_mbstring.dll extension=php_gd2.dll; Extension=php_mssql.dll remove the semicolon before the top 3. So the Apache can load these DLLs when it's started.
Add: Extension=php_sqlsrv_52_ts_vc6.dll (or Extension=php_pdo_sqlsrv_52_ts_vc6.dll), note: The two can only choose one, if two are added then Apache can not start.
Of course, we've also copied these DLLs into the system32 before. (Everyone notices how to load some DLLs into the installation process.)
3 Set Session save path lookup Session.save_path has such a line; Session.save_path = "N;/path" adds a line after this row (note that you add one line, not back) Session.save_path = "C:\WINDOWS\Temp" is saved to your temp directory. This can be completely saved to the Windows Temp directory under Temp
4 There are more noteworthy is short_open_tag. Some PHP versions are off by default. In other words, PHP can not use short tags such as the?> must use the <?php?> because of the convenience of short marks, and many programs are written in a short token, such as Discuz if the Short_open_tag Change to on will appear the symptom will be difficult to judge is the above reason, here recommends to modify lookup Short_open_tag = off to Short_open_tag = On
5 Display Error Display_errors for security reasons, display_errors Some versions also default to OFF. That is, when debugging, if the PHP code is wrong, only a blank page appears. The cause of the error and the number of rows are not displayed. This will be very inconvenient to debug, suggest that according to their own needs to modify the lookup display_errors = off (note not;-display_errors = off [security]) changed to Display_e Rrors = On
6 Show notice alert tip the fifth step opens the error prompt, but the error report is also controlled by error_reporting. PHP5 The default shutdown notice warning prompt, if it is in the local debugging, it is recommended to open notice warning prompt. Find error_reporting = e_all change to error_reporting = 7
Another hint, in the program can also through the error_reporting () control error report output, specific how to use everyone to refer to the manual.
7 Register_globals for security reasons it defaults to OFF when Register_globals=off, the next program should be received with $_post[' user_name ' and $_post[' User_pass '] When Register_globals=on, the next program can accept values directly using $user_name and $user_pass. It is recommended that I change it according to my needs, and I will change it to the compatibility issue.
8 php5 jet lag problem <?php echo date ("y-m-d h:i:s");? > Time difference eight hours why? PHP5 Series version of the new time zone settings, the default is GMT, and China is located in the East 8 area exactly 8 hours to find Date.timezone have such a line;d Ate.timezone = will; remove, change to Date.timezone = PRC of which Prc:people ' s Republic of China,
9 php5 upload file problem a. general file uploads, unless the file is small. Like a 5M file, it is likely to take more than a minute to upload. In PHP, however, the default page execution time is 30 seconds. That means more than 30 seconds, and the script stops executing. This results in a situation where the Web page cannot be opened. Then we can modify the Max_execution_time
Find Max_execution_time in php.ini the default is 30 seconds. Max_execution_time = 0 0 means no Limit
Another way is to add set_time_limit () to the PHP program. To set the longest execution time on the page. Set_time_limit (0);//0 says there is no limit.
B. Modify Post_max_size The maximum size allowed for post data. This setting also affects file uploads. The default post_max_size for PHP is 2M. If the POST data size is greater than post_max_size $_post and $_files superglobals will be empty. Find post_max_size. Change to Post_max_size = 150M
C. A lot of people will change the second step. But when uploading files, the maximum is still 8M. Why not? We also need to change a parameter upload_max_filesize represents the maximum size of the uploaded file. Find Upload_max_filesize, default 8M to Upload_max_filesize = 100M
In addition, Post_max_size is better than upload_max_filesize.
Apache Consolidated PHP
1 Open the Apache configuration document, taking the author's computer as an example: D:\myphp\apache2.2\conf\httpd.conf
2 Modify Site Root lookup documentroot There is a line documentroot "C:/Program files/apache Software Foundation/apache2.2/htdocs" This is your site's root directory, You can modify it, or you can use the default. If you change, you also need to modify the following item, or you may see a 403 error lookup this should is changed to whatever your set DocumentRoot to two lines below it <direc Tory "C:/Program Files/apache Software Foundation/apache2.2/htdocs" > put the above two C:/Program Files/apache Htdocs change to the directory you want.
3 Find DirectoryIndex index.html modified to DirectoryIndex index.html Index.html.var index.php so index.php can act as the default page
4 Apache Modular installation PHP Find # LoadModule Foo_module Modules/mod_foo.so joins a row after this row LoadModule php5_module c:/php5/php5apache2_2. Dll
(where C:/php5/php5apache2_2.dll is the appropriate path for you to install PHP.) Be careful not to put Php5apache2_2.dll, Php5apache2.dll and Php5apache.dll are confused. Php5apache.dll only applies to Apache version 1. The Php5apache2.dll in the PHP5 compression package only applies to the apache2.0.* version, and if it is 2.2.* the above version, you must use Php5apache2_2.dll. Otherwise, "Cannot load c:/php/ Php5apache2.dll into server:the specified module could is not found. "OR:" The requested operation the has. But after php5apache2_2.dll out, there is not much reference value.
5 Find AddType application/x-gzip. gz. tgz joins a row after this line AddType application/x-httpd-php. PHP so that Apache can explain PHP files to the configuration is basically complete
6 Restart Apache, create a phpinfo.php file in the root directory of the Web site
<?php phpinfo ();?>
Open in the browser. If you can see the PHP information normally, then PHP has been configured well.
The most critical step, that is, different from the loading of other database extensions, install Sqlncli.msi (SqlServer2008 client), the first time to match, tortured me for one weeks, because there is no installed client, so always prompted to find no extensions. Then put Ntwdblib.dll (2000.80.194.0), notice the version, PHP itself also has this file, is the old version, only support SqlServer2000.
Finally restart the Apache server, write a php file, test, everything OK, done!