Based on the reasons why PHP is better than other CGI

Source: Internet
Author: User

Q: Why is PHP better than other CGI? Is there any specific data that can prove the efficiency of PHP Execution and other CGI execution? Now my company uses C to write CGI. Will it be better if I change to PHP? Without a strong and powerful basis, I can't convince the above people to turn me into PHP... a: I think "good" requires three points. First, the program is fast to run. second, the execution efficiency is strong when there is a large number of accesses. third, program development is fast and easy to maintain. Php is not necessarily the best among the three points, but it is always C in the first place, comparison of PHP and Perl in terms of speed I use the formula below to test $ s = 1.0; for ($ I = 1; $ I <= 10; $ I ++) {for ($ j = 1; $ j <= 10; $ j ++) {$ s = $ s * 1.0005; $ s = $ s/1.0004 ;};}; print $ s;?> Then we tested it with AB-n 10000-c 20 http: // mycgi. As a result, the C language used 37.511 seconds. PHP3 used 45.393 seconds. PERL used 68.418 seconds. It seems that c is the fastest, there is no big difference between PHP3 and PHP3. 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 converted ed 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 encoded ed 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 converted ed Connnection Times (MS) min avg max Connect: 0 22 3005 Processing: 9 112 323 Total: 9 134 3328

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.