win2003+apache+php+sqlserver2008 Configuration
Pre-Installation Preparation:
1.apache2.2.2
2.php5.2.17
3.sqlserver2008
4.sqlncli.msi (SQL Server client, can go to Microsoft official website to download)
5.ntwdblib.dll (2000.80.194.0)
6.sqlsrv20.exe, which is Microsoftdriver 2.0 for PHP for SQL Server (SQL Server 2005 and 2008 uses 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 means that php5.2,53 represents php5.3,ts for thread safety, NTS for non-thread safety, VC6 is compiled with VC6 (VS2005), Vc9 is compiled with VS2008, VC6 applies to APACHE,VC9 for IIS.
To start the installation:
installation of Apache
1 Click Apahce Install package
2 Acceptance Agreement
3 The following 3 items can be filled out by Apache to listen to 80 ports. If IIS uses 80 ports, modify the IIS port or Apache port to avoid conflicts
(if the native test can fill 127.0.0.1)
4 The default is typical, it is recommended to choose Custom, click Next.
5 The installation path can be modified here, note that the installation path cannot contain Chinese.
6 Click Install to start the installation
7 after the installation is completed in the browser into the http://localhost or http://127.0.0.1 if you can see this page, prove that Apache installation success, can already explain the static page
installation of SQL Server ( abbreviated )
installation of PHP
Because PHP is a zip file (not the install version), the installation is more simple decompression on the line. Rename the extracted Php-5.2.17-win32 to PHP5. and copy it to the C drive 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 then copy the PHP directory Php5ts.dll, Php_mssql.dll to the directory C:\Windows\System32.
3 Copy the Php_gd2.dll,php_mssql.dll,php_mbstring.dll file under the Php5\ext directory to 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 in the back
Configuring PHP and associating SQL Server 2008
Open C:\windows\php.ini file 1 set extension path lookup Extension_dir has such a line Extension_dir = "./" To change this line to Extension_dir = "C:\php5\ext" where C:\php5 is the path to your installation of PHP. The DLL cannot be loaded correctly (note: some PHP versions are; extension_dir = "./" To remove the preceding semicolon)
2 respectively find; extension=php_mbstring.dll; extension=php_gd2.dll; extension=php_mssql.dll remove the semicolon in front of the above 3 items, This allows Apache to load these DLLs when it is started.
Add: Extension=php_sqlsrv_52_ts_vc6.dll (or Extension=php_pdo_sqlsrv_52_ts_vc6.dll), note: The two can only be selected, if two are added, Apache will not start.
Of course, we also copied these DLLs to System32. (Everyone in the installation process noticed how to load some DLLs into the.)
3 Set Session save path find Session.save_path has such a line; Session.save_path = "N;/path" adds a line after this line (note that it is added to a row, not added to the back) Session.save_path = "C:\WINDOWS\Temp" is saved to your temp directory, This can be saved entirely to the Windows Temp directory Temp
4 There are more notable is the Short_open_tag. Some PHP versions are off by default. In other words, PHP cannot use short tags such as <?> must use <?php?> because of the convenience of short marks, and many programs are written with just a short mark, such as Discuz if not put Short_open_tag Change to on will appear the symptoms will be difficult to determine is the above reason, here is recommended to modify find Short_open_tag = Off change to Short_open_tag = On
5 If error display_errors is displayed for security reasons, some versions of Display_errors are also Off by default. That is, when debugging, if the PHP code is wrong, only a blank page appears. Instead of displaying the cause of the error and the number of rows that were faulted. This will be very inconvenient to debug, it is recommended to modify the search according to their needs display_errors = off (note not;-display_errors = off [Security]) changed to Display_e Rrors = On
6 Show notice warning Fifth Step although the error prompt is turned on, the error report is also controlled by error_reporting. PHP5 default off notice warning prompt, if it is debugging locally, it is recommended to open the notice warning prompt. Find error_reporting = E_all changed to error_reporting = 7
Another hint, in the program can also be controlled by error_reporting () Error report output, how to use everyone to refer to the manual.
7 Register_globals For security reasons it is also off by default when Register_globals=off, the next program should receive $_post[' user_name ' and $_post[' User_pass '] When Register_globals=on, the next program can accept values directly using $user_name and $user_pass. We recommend that you modify it to suit your needs, and I'll change it to on for compatibility.
8 php5 time difference question <?php echo date ("y-m-d h:i:s");? What is the difference between > time and eight hours? PHP5 Series new time zone setting, default is GMT, and China is located in the East 8 district exactly 8 hours to find date.timezone there is such a line;d Ate.timezone = will; remove, change to Date.timezone = PRC of which Prc:people's Republic of China,
9 php5 uploading files problem a. general file uploads, unless the file is small. Like a 5M file, it's likely to take more than a minute to upload. In PHP, however, the default maximum execution time for this page is 30 seconds. That means more than 30 seconds, 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. Change to 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 of the page. Set_time_limit (0);//0 says there is no limit
B. Modify Post_max_size to set the maximum allowable size for post data. This setting also affects file uploads. PHP default post_max_size is 2M. If the POST data size is larger 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. However, the maximum upload file is still 8M. Why, we're going to change one. The parameter upload_max_filesize indicates the maximum size of the uploaded file. Find Upload_max_filesize, default is 8M to Upload_max_filesize = 100M
It is also stated that the post_max_size is better than upload_max_filesize.
ApacheIntegrationPhp
1 Open the Apache configuration document, take the author's computer as an example: D:\myphp\apache2.2\conf\httpd.conf
2 Modify the site root directory find DocumentRoot There is a line documentroot "C:/Program Files/apache software Foundation/apache2.2/htdocs" This is the root directory of your site, You can modify, or you can use the default. If you change it, you may have to change the following, or you might see a 403 error finding this should is changed to whatever you set documentroot the two lines below it have <direc Tory "C:/Program Files/apache software Foundation/apache2.2/htdocs" > put the above two items C:/Program Files/apache Group/Apache2/ 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 in Modular installation PHP find # LoadModule Foo_module modules/mod_foo.so Add a row LoadModule php5_module c:/php5/php5apache2_2 after this line. Dll
(where C:/php5/php5apache2_2.dll is the appropriate path for you to install PHP.) Take care 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 is only available for apache2.0.* versions, and Php5apache2_2.dll must be used if the above version is 2.2.*. "Cannot load c:/php/may appear Php5apache2.dll into server:the specified module could isn't be found. "OR:" The requested operation has failed "case. But after the php5apache2_2.dll out there is not much reference value)
5 Find AddType application/x-gzip. gz. tgz add a line of AddType application/x-httpd-php after this line. PHP so Apache can explain PHP files to this configuration basically done
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 correctly, then PHP has been configured.
1,.
2, the most critical step, that is, different from the loading of other database extensions, the installation of Sqlncli.msi (SqlServer2008 client), the first time, tortured me for one weeks, because there is no client, so always hint that the extension is not found. Then put Ntwdblib.dll (2000.80.194.0), note the version, PHP itself has this file, is the old version, only support SqlServer2000.
Finally restart the Apache server, write a php file, test it, everything OK, done!