ʹÓÃnginxÅäÖöà¸öphp fastcgi¸ºÔؾùºâ
ÅäÖû¹ÊǷdz£¼òµ¥µÄ£¬³ä·ÖÌåÏÖÁËnginxµÄÇ¿´óÓëÅäÖõļòµ¥^^ÏÂÃæÊÇ´óÖµķþÎñÆ÷½á¹¹Í¼£º
Ó¦ÓõÄ×îÇ°¶ËÊÇһ̨nginx·þÎñÆ÷£¬ËùÓо²Ì¬µÄÄÚÈݶ¼ÓÉnginxÀ´´¦Àí£¬¶ø½«ËùÓÐphpµÄÇëÇ󶼷Ö̯µ½ÏÂÓεÄÈô¸Ę́ÔËÐÐphp fastcgiÊØ»¤½ø³ÌµÄ·þÎñÆ÷ÖУ¬ÕâÑù¿ÉÒÔÒÔÒ»ÖÖÁ®¼ÛµÄ·½°¸À´ÊµÏÖ¶Ôϵͳ¸ºÔصķÖ̯£¬À©Õ¹ÏµÍ³µÄ¸ºÔØÄÜÁ¦¡£
Èý̨php fastcgi·þÎñÆ÷µÄipµØÖ··Ö±ðΪ£º
172.16.236.110 , 172.16.236.111, 172.16.236.112
ÔËÐÐphp fastcgi½ø³Ìʱ£¬ÐèÒªÈÃphp-cgi¼àÌýµ½·þÎñÆ÷µÄ¾ÖÓòÍøµØÖ·£¨·Ö±ðÈçÉÏËùʾ£©£¬¶ø²»ÊÇ֮ǰһ°ã¶¼ÊǼàÌýµÄ±¾µØµØÖ·£¨127.0.0.1£©¡£ÒÔ172.16.236.110Õą̂·þÎñÆ÷ΪÀý£º
1
/usr/local/php5/bin/php-cgi -b 172.16.236.110:9000
»òÐíÄãÓÃspawn-fcgiÀ´Æô¶¯php-fcgi£¬ÄÇô¾ÍÊÇÕâÑù£¨¹©²Î¿¼£¬ÆäʵҲ¾ÍÊÇÐ޸ļàÌýµÄµØÖ·ºÍ¶Ë¿Ú¼´¿É£©£º
1
/usr/local/lighttpd/bin/spawn-fcgi -f /usr/local/php5/bin/php-cgi -a 172.16.236.110 -p 9000
ÓÖ»òÐíÄãÊÇÓÃphp-fpmÀ´¹ÜÀíphp-fcgi£¬ÄÇôÄãÐèÒªÐÞ¸Äphp-fpmµÄÅäÖãº
1
vi /usr/local/php5/etc/php-fpm.conf
ÕÒµ½Õâ¸öÅäÖÃÏÆäÖеĵØÖ·¿ÉÄÜÐèÒª¸ù¾ÝÄã×Ô¼º»·¾³À´µ÷Õû£©
<value name="listen_address">127.0.0.1:9000</value>
ÐÞ¸ÄΪ£º<value name="listen_address">127.0.0.1:9000</value>
ÐÞ¸ÄÍê±Ïºó£¬ÖØÆôÄãµÄphp-fpm½ø³Ì¡£
È»ºó°´ÕÕÉÏÃæµÄ²½Ö裬ÒÀ´ÎÐÞ¸ÄÆäËûphp fastcgi·þÎñÆ÷¡£
php·½ÃæµÄ¹¤×÷ÔÝʱ¾ÍÊÇÕâЩ£¬ÏÂÃæÐÞ¸Änginx¡£
1
vi /usr/local/nginx/conf/nginx.conf
ÔÚÅäÖÃÎļþµÄhttp¶ÎÄÚÔö¼ÓÀàËÆÈçϵÄÅäÖãº
1
2
3
4
5
upstream myfastcgi {
server 172.16.236.110 weight=1;
server 172.16.236.111 weight=1;
server 172.16.236.112 weight=1;
}
ÎÒÕâÀïÈý̨php fastcgi·þÎñÆ÷µÄȨÖØÊÇÏàͬµÄ£¬ËùÒÔÆäÖеÄweightÖµ¶¼ÊÇ1£¬Èç¹ûÄãµÄphp fastcgi·þÎñÆ÷ÐèÒª·ÖÖ÷´Î£¬ÄÇô¿ÉÒÔͨ¹ýµ÷ÕûÆäweightÖµÀ´´ïµ½Ä¿µÄ¡£±ÈÈçÒÔµÚһ̨·þÎñÆ÷ΪÖ÷£¬ÆäËûÁ½Ì¨Îª¸¨£¬Ôò¾ÍÊÇÕâÑù£º
1
2
3
4
5
upstream myfastcgi {
server 172.16.236.110 weight=1;
server 172.16.236.111 weight=2;
server 172.16.236.112 weight=2;
}
È»ºóÕÒµ½ÔÀ´nginx¹ØÓÚphp fastcgiÅäÖõIJ¿·Ö£¬±ÈÈ磺
1
2
3
4
5
6
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
includ
Ïà¹ØÎĵµ£º
×î½üÔÚ×öPHPÓëÊý¾Ý¿â½»»¥µÄproject£¬¼±ÓÚÇó³É£¬Ä£·ÂÁËÏÂÀý×ӾͿªÊ¼¶¯ÊÖ£¬½á¹ûÎó°Ñmysql_fetch_arrayд³ÉÁËmysql_fetch_row,囧ÊÂÀ´ÁË£¬·¢ÏÖ·µ»ØµÄÊý×é¾ÓÈ»ÊÇindex=>valueµÄÐÎʽ£¬¶øÃ÷Ã÷¼ÇµÃÊÇfield name=>valueµÄ¹þ£¬²éÊÖ²á²ÅÃ÷°×¡£
1. mysql_fetch_arrayµÄº¯ÊýÔÐÍÊÇ
array mysql_fetch_array ( resour ......
Éú³É6 ~ 16λµÄÓû§ÃûÈô¸É¸ö£¬Ö÷ÒªÊÇÎı¾²Ù×÷£¬µ«ÊÇÇ°ÌáÊÇÒªÓÐÒ»¸ö×Ö·û´®°ü¡£Ö÷Òª°üº¬Èý¸ö³ÌÐò¡£
³ÌÐòÒ»£º¸ºÔð´Ó×ÖµäÖÐËæ»úÌáÈ¡Êý¾Ý£¬Ð´ÈëÒ»¸öÐÂÎļþ¡££¨1.php£©
<?php
/* ´Ó×ÖµäÎļþÖÐÌáÈ¡Ëæ»úÖµ */
$file1 = "./Words.dic";
$file2 = "./common_pass_mini.dic";
$file3 = "./Sys_Month_Date.Dic";
$rfile = "./ ......
ÔÚwindows²Ù×÷ϵͳÅäÖÃPHP»·¾³£¬¿ÉÒÔÓÃIIS×öÓ¦Ó÷þÎñÆ÷£¬Ò²¿ÉÒÔʹÓÃApache×öÓ¦Ó÷þÎñÆ÷¡£±¾ÎĽéÉÜÔÚWindows XP²Ù×÷ϵͳÏÂÅäÖÃPHPºÍApache»·¾³¡£
×¼±¸¹¤×÷£º
1¡¢ÔÚhttp://windows.php.net/download/ÏÂÔØPHP³ÌÐò°ü£¬ÒòΪÓÃApache×öÓ¦Ó÷þÎñÆ÷£¬Ñ¡ÔñÓÃVC6±àÒëµÄ ......
×¼±¸ÖªÊ¶£º
Ubuntu :
Ubuntu ÊÇlinuxµÄÒ»¸ö°æ±¾£¬ÓзÇÖÞ·¢²¼µÄ£¬ÏÖÔڱȽÏÁ÷ÐеÄÒ»¸ö°æ±¾¡£
²Î¿¼°Ù¶È˵Ã÷Ubuntu
nginx ¡¡£º
Nginx ("engine x") ÊÇÒ»¸ö¸ßÐÔÄÜµÄ HTTP ºÍ ·´Ïò´úÀí ·þÎñÆ÷£¬Ò²ÊÇÒ»¸ö IMAP/POP3/SMTP ´úÀí·þÎñÆ÷¡£ Nginx ÊÇÓÉ Igor Sysoev Ϊ¶íÂÞ˹·ÃÎÊÁ¿µÚ¶þµÄ Rambler.ru Õ¾µã¿ ......
½üÈÕÔÚÓÃ×Ô¼ºÒÔǰдµÄhttpÏÂÔØÆ÷ÏÂÔØijһ¸öphpÒ³ÃæÒÔÍâÔâÓö403´íÎó.µ«ÊÇieÈ´Äܹ»ÕýÈ··ÃÎÊ. ÈÕÖ¾ÈçÏÂ: IE: Time At:0005504671
Line:10
send: 192.168.1.2 –> xxx.xxx.xxx.xxx len:351
GET /test.jpg HTTP/1.1
Accept: */*
Accept-Language: en-us
Accept-Enc ......