티스토리 뷰

CentOS 5 WEB Server Install SpeedyCGI


Install SpeedyCGI

 

Enable SpeedyCGI and makes Perl scripts be fast. The difference from mod_perl is that processes of SpeedyCGI are separated from Apache's processes.



1. Install SpeedyCGI.


[root@www ~]# yum --enablerepo=epel -y install perl-CGI-SpeedyCGI   # install from EPEL




2. How to use ( how to write codes ).

Replace The PATH from "#!/usr/bin/perl" to "#!/usr/bin/speedy".

But Be careful to write codes.

For example, there is a test script like follows.




#!/usr/local/bin/perl


use strict;

use warnings;


print "Content-type: text/html\n\n";

print "<html>\n<body>\n";

print "<div style=\"width:100%; font-size:40px; font-weight:bold; text-align:center;\">";


my $a = 0;

&number();


print "</div>\n</body>\n</html>";


sub number {

   $a++;

   print "number \$a = $a";

}

 

The result of executing the script above is like follows. The result is never change even if reloading again and again, of course.


  However, if changing the script to SpeedyCGI environment, the result is like follows, the number increases.


  As the example, under the SpeedyCGI ( Registry mode of mod_perl is also the same ) environment, because parameters are also kept in RAM, maybe the result you intent would change like this example. To get the same result under the SpeedyCGI environmet for this example, it must write like follows. Anyway, if you use SpeedyCGI or Registry mode of mod_perl or FastCGI, Be Careful to use parameters.



#!/usr/bin/speedy


use strict;

use warnings;


print "Content-type: text/html\n\n";

print "<html>\n<body>\n";

print "<div style=\"width:100%; font-size:40px; font-weight:bold; text-align:center;\">";


my $a = 0;

&number($a);

print "</div>\n</body>\n</html>";


sub number {

   my($a) = @_;

   $a++;

   print "number \$a = $a";

}


※ Next manual



저작자 표시 비영리 변경 금지
신고

'EN > CentOS 5' 카테고리의 다른 글

CentOS 5 WEB Server Basic Auth + LDAP  (0) 2016.06.04
CentOS 5 WEB Server Use proxy_http  (0) 2016.06.04
CentOS 5 WEB Server Install SpeedyCGI  (0) 2016.06.04
CentOS 5 WEB Server Use PHP APC  (0) 2016.06.04
CentOS 5 WEB Server Configure WebDAV  (0) 2016.06.01
CentOS 5 WEB Server Virtual Hostings  (0) 2016.06.01
댓글