Home >Backend Development >PHP Tutorial >For what reasons PHP is better than other CGI_PHP Tutorial

For what reasons PHP is better than other CGI_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:24:08810browse

Q: For what reasons is PHP better than other CGIs? Is there any more specific data that can prove the efficiency of PHP execution compared with other CGI executions? Now my company uses C to write CGI. If I switch to PHP, what will happen? Isn't it better? Without a strong basis, I won't be able to convince the people above to let me switch to PHP... A: I think "good" must have three points. First: the execution of the written program. Fast. Second: The execution performance is strong when there is a large amount of access. Third: The program development time is fast and easy to maintain. Among these three points, PHP is not necessarily the best, but it is still at the top. The following is the comparison of C, PHP and Perl in terms of speed. I used the following calculation to test $s=1.0; for ($i= 1;$i Then use ab -n 10000 -c 20 http://mycgi to test. The result is that C language took 37.511 seconds, PHP3 took 45.393 seconds, and PERL took 68.418 seconds. It seems that C is the fastest, but , there is not much difference between the results of PHP3. Perl is the slowest. The following is the test data ================================ ============== C language ================================== ============ Document Path: /~evan/test/gcc.cgi Document Length: 19 bytes Concurrency Level: 20 Time taken for tests: 37.511 seconds Complete requests: 10000 Failed requests: 0 Total transferred : 1750000 bytes HTML transferred: 190000 bytes Requests per second: 266.59 Transfer rate: 46.65 kb/s received Connnection Times (ms) min avg max Connect: 0 30 3001 Processing: 4 40 69 Total: 4 70 3070 PHP3 ===== ========================================= Document Path: /~evan/test/ php3.php3 Document Length: 15 bytes Concurrency Level: 20 Time taken for tests: 45.393 seconds Complete requests: 10000 Failed requests: 0 Total transferred: 1710000 bytes HTML transferred: 150000 bytes Requests per second: 220.30 Transfer rate: 37.67 kb/s received Connnection Times (ms) min avg max Connect: 0 34 3039 Processing: 6 53 183 Total: 6 87 3222 PERL ========================== ==================== Document Path: /~evan/test/perl.cgi Document Length: 17 bytes Concurrency Level: 20 Time taken for tests: 68.418 seconds Complete requests : 10000 Failed requests: 0 Total transferred: 1730173 bytes HTML transferred: 170017 bytes Requests per second: 146.16 Transfer rate: 25.29 kb/s received Connnection Times (ms) min avg max Connect: 0 22 3005 Processing: 9 112 323 Total: 9 134 3328

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532173.htmlTechArticleQ: For what reasons is PHP better than other CGI? Is there any more specific data that can prove the execution of PHP? How efficient is it compared to other CGI implementations? Now my company uses C to write CGI,...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn