The positioning result is as follows:
Customer environment:
Windows server 2003 r2 standard edition sp2
Mysql Ver 14.12 Distrib 5.0.18, for Win32 (ia32)
In apache 2.2
Rising
Webshield client 1.08
The problem has been reproduced. It can be optimized. It cannot be determined that it is caused by webshield.
Build Environment:
Windows server 2003 r2 standard edition sp2
Mysql 5.0.18 for win32
Apache-2.2.21-win32-x86-no_ssl
Php-5.2.17-win32-vc6-x86
Rising 23.00.50.25
Several problems encountered during Environment setup:
When downloading apache and php, pay attention to the matching problem between apache and php.
A) PHP5.3 has VC6 and VC9 versions. Select VC6 version. The reason is as follows:
I. VC6 is compiled using the Visual Studio 6 compiler. If your PHP is built using Apache, you should select VC6.
Ii. The VC9 version is compiled using the Visual Studio 2008 compiler. If your PHP is set up using IIS, select the VC9 version.
B) PHP5.3 Thread Safe and Non Thread Safe versions. Apache no_ssl should be used with php Thread Safe. If it works with Non Thread Safe, an error occurs during apache startup: "Apache is running a threaded MPM, but your PHP Modle is not compiled to be threadsafe. You need to recompile PHP ."
I. Thread Safe is Thread security. During execution, the Thread security check is performed to prevent the new Thread from consuming system resources by starting the CGI execution mode. The ISAPI is executed in the form of a DLL dynamic library. It can be executed after a user request. After processing a user request, it will not disappear immediately. Therefore, thread security check is required, in this way, the program execution efficiency is improved. If you use ISAPI to execute PHP, we recommend that you select the Thread Safe version;
Ii. Non-Thread Safe is Non-Thread-Safe. No Thread security check is performed during execution. FastCGI executes operations in a single thread, so it does not need to perform thread security checks. Apart from the thread security check protection, it can improve the execution efficiency. Therefore, if FastCGI is used to execute PHP, we recommend that you select the Non-Thread Safe version.
Note that apache correctly configures the website and PHP. Pay special attention to the configuration of LoadModule, PHPIniDir, DocumentRoot, ServerRoot, Directory, DirectoryIndex, AddType application/x-httpd-php in the configuration file.
After installing mysql (Administrator Account Password: admin/admin), failed to connect to the database using admin in PHP code, run "mysql-u root-p" in cmd to enable "root" to connect to the database normally.
Recurrence:
PHP maximum execution time limit.
A) The maximum php Execution time is 30 seconds by default. The execution is aborted after 30 seconds, and the connection to mysql is also disconnected.
B) Try to increase this value, modify the php. ini configuration file under the php Directory, and change max_execution_time = 30 to max_execution_time = 300. If it is set to 0, the maximum PHP Execution time is not limited.
C) Avoid mysql connection failure due to the maximum execution time limit.
Mysql cannot be connected due to high website traffic.
A) Write a php script to test mysql. It is found that mysql will soon become unable to connect when frequent connection/disconnection operations are performed on mysql (error code: 10048 ). When all connections are aborted, mysql returns to normal after 2 minutes. If the connection is not stopped, mysql cannot be connected.
B) Try Optimization in two aspects:
I. Modify the TcpTimedWaitDelay value of the windows registry entry to 30 (240 s by default). reduce this value to allow TCP/IP to release closed connections more quickly and provide more resources for new connections.
Ii. modify the MaxUserPort value of the windows registry to 53768 (this value indicates the maximum number of ports used when the system requests any available user ports, and the maximum number of ports that can be specified by TCP/IP. The default value is 5000) to process more requests.
C) after the registry key is modified, the mysql situation is greatly improved: mysql connection errors are greatly reduced, and self-recovery after errors is improved.
For the preceding two cases, webshield 1.08 and webshield 1.08 are installed respectively, and the test results are the same.
Optimization:
Max_execution_time modification:
Open the php. ini file in the php Directory, find max_execution_time = 30, and change 30 to the expected number.
Modify TcpTimedWaitDelay and MaxUserPort:
Copy codeThe Code is as follows:
[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters]
"TcpTimedWaitDelay" = dword: 0000001e
"MaxUserPort" = dword: 00008000