Nginx+PHP+MySQLË«»ú»¥±¸¡¢È«×Ô¶¯Çл»·½°¸
ÔÚÉú²úÓ¦ÓÃÖУ¬Ä³Ì¨“Nginx+PHP+MySQL”½Ó¿ÚÊý¾Ý·þÎñÆ÷£¬°çÑݵĽÇÉ«Ê®·ÖÖØÒª£¬Èç¹û·þÎñÆ÷Ó²¼þ»òNginx¡¢MySQL·¢Éú¹ÊÕÏ£¬¶ø ¶Ìʱ¼äÄÚÎÞ·¨»Ö¸´£¬ºó¹û½«·Ç³£ÑÏÖØ¡£ÎªÁ˱ÜÃâµ¥µã¹ÊÕÏ£¬ÎÒÉè¼ÆÁË´ËÌ×·½°¸£¬±àдÁËfailover.sh½Å±¾£¬ÊµÏÖÁËË«»ú»¥±¸¡¢È«×Ô¶¯Çл»£¬¹ÊÕÏתÒÆʱ¼ä Ö»Ð輸ʮÃë¡£
Ò»¡¢Ë«»ú»¥±¸¡¢È«×Ô¶¯Çл»·½°¸£º
1¡¢ÍØÆËͼ£º
2¡¢½âÊÍ£º
(1)¡¢¼ÙÉèÍâÍøÓòÃûblog.s135.com½âÎöµ½ÍâÍøÐéÄâIP 72.249.146.214ÉÏ£¬ÄÚÍøhostsÉèÖÃdb10¶ÔÓ¦ÄÚÍøÐéÄâIP 192.168.146.214
(2)¡¢Ä¬ÈÏÇé¿öÏ£¬ÓÉÖ÷»ú°ó¶¨ÄÚ¡¢ÍâÍøÐéÄâIP£¬±¸»ú×÷Ϊ±¸·Ý£¬µ±Ö÷»úµÄMySQL¡¢Nginx»ò·þÎñÆ÷³öÏÖ¹ÊÕÏÎÞ·¨·ÃÎÊʱ£¬±¸»ú»á×Ô¶¯½Ó¹ÜÄÚ¡¢ÍâÍø ÐéÄâIP¡£Á½Ì¨·þÎñÆ÷¶¼Æô¶¯¸ºÔð¼à¿Ø¡¢×Ô¶¯Çл»ÐéÄâIPµÄÊØ»¤½ø³Ì/usr/bin/nohup /bin/sh /usr/local/webserver/failover/failover.sh 2>&1 > /dev/null &
(3)¡¢Ö÷»úºÍ±¸»úÉϵÄMySQL·þÎñÆ÷»¥ÎªÖ÷´Ó£¬»¥Ïàͬ²½¡£ÔÚÖ÷»ú´¦Óڻ״̬£¨¼´ÓÉÖ÷»ú°ó¶¨ÐéÄâIP£©Ê±£¬¶ÁдÖ÷»úµÄ MySQL£¬Ð´µ½Ö÷»úµÄÊý¾Ý»áͬ²½µ½±¸»ú£»ÔÚ±¸»ú´¦Óڻ״̬ʱ£¬¶Áд±¸»úµÄMySQL£¬Ð´µ½±¸»úµÄÊý¾Ý»áͬ²½µ½Ö÷»ú£¨Èç¹ûÖ÷»úÉϵÄMySQLËÀµôÔÝʱÎÞ ·¨Í¬²½£¬Ö÷»úÉϵÄMySQL»Ö¸´ºó£¬Êý¾Ý»á×Ô¶¯´Ó±¸»úÉÏͬ²½¹ýÀ´£¬·´Ö®ÒàÈ»£©¡£
(4)¡¢Ö÷»ú´¦Óڻ״̬ʱ£¬Ã¿20Ãë»á°Ñ /data0/htdocs/£¨ÍøÒ³¡¢³ÌÐò¡¢Í¼Æ¬´æ·ÅĿ¼£©¡¢/usr/local/webserver/php/etc/£¨php.iniµÈÅäÖÃÎļþÄ¿ ¼£©¡¢/usr/local/webserver/nginx/conf/£¨NginxÅäÖÃÎļþĿ¼£©Èý¸öĿ¼ÏµÄÎļþͨ¹ýrsyncÍÆË͵½±¸»ú·þÎñÆ÷ÉÏ µÄ¶ÔӦĿ¼£¨ÔöÁ¿ÍÆËÍ£¬Á½Ì¨·þÎñÆ÷ÉÏÒ»ÑùµÄÎļþ²»»áÖظ´ÍÆËÍ£©£¬·´Ö®Èç¹û±¸»ú´¦Óڻ״̬ʱ£¬Ã¿20Ãë»á³¢ÊÔ°ÑÎļþÍÆË͵½Ö÷»ú¡£rsyncµÄÅäÖÃÎļþ¼ûÁ½ ̨·þÎñÆ÷µÄ/etc/rsyncd.conf£¬rsyncÊØ»¤½ø³ÌµÄÆô¶¯ÃüÁîΪrsync –daemon
3¡¢×Ô¶¯Çл»Á÷³Ì
(1)¡¢Ö÷»úĬÈÏ°ó¶¨ÄÚ¡¢ÍâÍøÐéÄâIP£¬µ±Ö÷»úµÄMySQL¡¢NginxÎÞ·¨·ÃÎÊ»ò·þÎñÆ÷å´»ú£¬Ö÷»úÉϵÄfailover.shÊØ»¤½ø³Ì»á×Ô¶¯Õª³ý×Ô¼º °ó¶¨µÄÄÚ¡¢ÍâÍøÐéÄâIP£¨Èç¹ûÖ÷»úÉϵÄfailover.shËÀµô£¬ÎÞ·¨Õª³ý×Ô¼º°ó¶¨µÄÐéÄâIPҲû¹Øϵ£©£¬±¸»úÉϵÄfailover.shÊØ»¤½ø³Ì»á×Ô ¶¯½Ó¹Ü±¸»úÔÀ´°ó¶¨µÄÄÚ¡¢ÍâÍøÐéÄâIP£¬²¢·¢ËÍARPing°ü¸øÄÚ¡¢ÍâÍøÍø¹Ø¸üÐÂMAC£¬Ç¿Ðнӹܡ£
(2)¡¢±¸»ú°ó¶¨ÐéÄâIPºó£¬»á·¢ËÍARPing°ü¸øÄÚ¡¢ÍâÍøÍø¹Ø£¬Í¨ÖªÍø¹Ø¸üÐÂÐéÄâIPµÄMACµØַΪ±¸»úµÄMACµØÖ·£¬´Ó¶ø±£Ö¤ÁËÇл»ºóÄܹ»Í¨¹ýÐéÄâIP¼°Ê±·ÃÎʵ½±¸»ú¡£
(3)¡¢Èç¹ûÖ÷»úµÄMySQL¡¢NginxÆô¶¯ÆðÀ´£¬È
Ïà¹ØÎĵµ£º
¸ù¾ÝGyPSii APIÌṩµÄ²Ù×÷ÀàºÍ·½·¨£¬·¢ÏÖÇëÇó»áʧ°Ü£¬·µ»ØµÄÊÇÒ»¸öbed request¡£ÔÒòÆäʵºÜ¼òµ¥£¬µ«Ò»Ö±Ã»ÓÐÕÒµ½£¬×îÖÕÔÒòÊǶԷ½ÌṩµÄhostÊÇ´íÎóµÄ£¬Ã»ÌìÀí¡£
¶Ô·½ÌṩµÄhostºÍuri£º
host:http://dev3.gypsii.com/gypsii
uri:http://dev3.gypsii.com/gypsii/xmlservice.cgi
Õâ¸öhost¾ÍÊÇ´íµÄ£¬Ó¦¸ÃÊÇ£ºdev3.gypsii.co ......
Óï·¨: boolean session_register(string name);
×¢²áеıäÁ¿¡£
·µ»ØÖµ: ²¼¶ûÖµ
º¯ÊýÖÖÀà: ×ÊÁÏ´¦Àí
ÄÚÈÝ˵Ã÷
±¾º¯ÊýÔÚÈ«Óò±äÁ¿ÖÐÔö¼ÓÒ»¸ö±äÁ¿µ½Ä¿Ç°µÄ Session Ö®ÖС£²ÎÊý name ¼´ÎªÓû¼ÓÈëµÄ±äÁ¿Ãû¡£³É¹¦Ôò·µ»Ø true Öµ¡£
¼ÙÈçÔÚÍ·Îļþ£¬¿ªÆôsession,¼´Ê¹ÓÃsession_start()º¯ÊýºóÃæ¼ÓÉÏsession_register(string na ......
ÒÔ϶¼ÊÇתÔØ£¬ ¼òµ¥ËµÏ£¬ phpÊDz»Ö§³Ö¶àÏ̵߳ġ£¡£¡£¡£
PHPÓïÑÔ±¾ÉíÊDz»Ö§³Ö¶àÏ̵߳Ä. ×ܽáÁËÒ»ÏÂÍøÉϹØÓÚPHPÄ£Äâ¶àÏ̵߳ķ½·¨, ×ܵÄÀ´Ëµ, ¶¼ÊÇÀûÓÃÁËPHPµÄºÃ»ï°éÃDZ¾ÉíËù¾ßÓеĶàÏß³ÌÄÜÁ¦. PHPµÄºÃ»ï°éÖ¸µÄ¾ÍÊÇLINUXºÍAPACHEÀ², LAMPÂï.
ÁíÍâ, ¼ÈÈ»ÊÇÄ£ÄâµÄ, ¾Í²»ÊÇÕæÕýµÄ¶àÏß³Ì. ÆäʵֻÊǶà½ø³Ì. ½ø³ÌºÍÏß³ÌÊÇ ......
php cliÃüÁîÐÐģʽÊÇWINϵÄÒ»¸öSHELL£¬²»ÐèÒªAPACHEµÄÖ§³Ö¾ÍÄÜÖ´ÐÐPHP½Å±¾µÄ½Å±¾£¬²¢ÇÒÊdzÖÐøÖ´Ðеġ£ÕâЩÌصãºÜÈÝÒ×ÀûÓÃÀ´¿ìËÙ²âÊÔPHP½Å±¾¡£½ñÌì¾ÍÌØÒâÕÒÀ´Ò»Ð©×ÊÁÏ£¬ÕûÀíÁËһϣ¬È¨µ±¸´Ï°¡£
D:\AppServ\php5>php -help
Usage: php [options] [-f] <file> [--] [args...]
&nbs ......
ip_contrl.php:
<?php
//include('header.php');
$ipaddr = $_POST['ipaddr'];
$netmask = $_POST['netmask'];
$gateway = $_POST['gateway'];
$mac = $_POST['mac'];
$dns1 = $_POST['dns1'];
$dns2 = $_POST['dns2'];
//echo "ipaddr=$ipaddr;netm ......