Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

³¢ÊÔÓÃGearmanʵÏÖ·Ö²¼Ê½´¦Àí£¨PHP£©

±¾ÎÄÐèÒªÄãÒѶÔGearmanÓиö´óÖÂÁ˽⣬Èç¹û²»Öª¸Ã¶«¶«ÊǺÎÎÇë²Î¿¼Ö®Ç°Ò»Æª×ªÌûÈÕÖ¾¡¶Gearman - ·Ö²¼Ê½Ô¶³Ì¹ý³Ì´¦Àí¿ò¼Ü¡·
˳±ãÔÙÍƼöÁ½Æª²Î¿¼ÎÄÕÂ
http://hi.baidu.com/thinkinginlamp/blog/item/ff49972b9e7378f3e6cd40aa.html
£¨Ñ§Ñ§Gearman£©
http://www.ibm.com/developerworks/cn/opensource/os-php-gearman/index.html
£¨Óà Gearman ·Ö·¢ PHP Ó¦ÓóÌÐòµÄ¹¤×÷¸ºÔØ£©
¸ü¶à²Î¿¼´ó¼Ò»¹ÊÇ×Ô¼ºgoogle°É:)
±¾ÎÄÖ»¼Ç¼ÎÒʵ¼ùµÄ¹ý³ÌºÍÆäÖпÉÄÜÓöµ½µÄÎÊÌâ¡£
ÊÔÑé»·¾³£¨ÐéÄâ»ú£©£ºubuntu9.04 + PHP5.2.6
¿ªÊ¼ÁË¡£¡£¡£
ÏÈ°²×°ÈÎÎñ·Ö·¢µÄJob¶Ë
°²×°Gearman server and library£º
wget http://launchpad.net/gearmand/trunk/0.8/+download/gearmand-0.8.tar.gz
tar zxf gearmand-0.8.tar.gz
cd gearmand-0.8
./configure
sudo make
sudo
make install
Öмä¿ÉÄÜ»áÓöµ½Ð©ÎÊÌ⣺
ÔÚ./configureµÄʱºò£¬¿ÉÄÜ»á³öÏÖȱÉÙlibrariesµÄÇé¿ö£¬Ò»°ãÊÇȱÉÙlibeventºÍuuidÕâÁ½¸ö¿ª·¢°ü£¬°²×°Ö®¡£¡£¡£
sudo apt-get install libevent-dev
sudo apt-get install uuid-dev
°²×°Íê³ÉºóÔÙÖØÐÂÅäÖð²×°£¬°²×°Íê³ÉºóÖ´ÐÐ
sudo ldconfig
ÒòΪ±¾ÊÔÑéClientºÍWorker¶Ë¶¼ÓÉPHPÀ´ÊµÏÖ£¬ËùÒÔÐèÒª°²×°phpµÄgearmanÀ©Õ¹
°²×°Gearman PHP extension£º
wget http://pecl.php.net/get/gearman-0.4.0.tgz
tar zxf gearman-0.4.0.tgz
cd gearman-0.4.0
phpize
./configure
sudo make
sudo make install
Öмä¿ÉÄÜÓöµ½µÄÎÊÌ⣺
ÕÒ²»µ½phpizeÃüÁphpizeÔÚphp¿ª·¢°üÖУ¬ËùÒÔÒªÏÈ°²×°php5-dev
sudo apt-get install php5-dev
°²×°Íêºó£¬¾Í¿ÉÒÔÔÚÔ´ÂëĿ¼ÖÐÖ´ÐÐphpizeÉú³ÉÏà¹Ø°²×°ÅäÖÃÐÅÏ¢£¬½Ó×ÅÖ´ÐкóÃæµÄ./configureµÈ
make installºó£¬Ëü¸æËßÄãÒ»¸öĿ¼£¬Éú³ÉµÄgearman.so¾ÍÔÚÄÇÀï¡£
¸ù¾ÝÐèÒª¿¼µ½ÏàÓ¦PHPµÄÀ©Õ¹Ä¿Â¼ÀÒòΪÎÒÖ±½ÓÓÃϵͳĬÈÏ°²×°µÄphp£¬Ëü×Ô¶¯Éú³É¾ÍÔÚÀ©Õ¹ÖУ©
½ÓÏÂÀ´ÐÞ¸Äphp.iniÒÔʹphp¼ÓÔظÃÄ£¿é£º
php --ini
¿´ÏÂphp.iniÔÚÄÄÀsudo vim ÐÞ¸ÄÖ®£¬ÔÚÆäÖмÓÈë
extension = "gearman.so"
È»ºó£¬¿ªÊ¼±àдclientºÍworker¶Ë
client.php
<?php
$client= new GearmanClient();
$client->addServer("127.0.0.1", 4730);
print $client->do("title", "Linvo");
print "\n";
?>
worker.php
<?php
$worker= new GearmanWorker();
$worker->addServer("127.0.0.1", 4730);
$worker->addF


Ïà¹ØÎĵµ£º

php ÖÐ Cookie Ïê½â

1.ÓÃ;:
        ·þÎñÆ÷¿ÉÒÔÀûÓÃCookies°üº¬ÐÅÏ¢µÄÈÎÒâÐÔÀ´É¸Ñ¡²¢¾­³£ÐÔά»¤ÕâЩÐÅÏ¢£¬ÒÔÅжÏÔÚHTTP´«ÊäÖеÄ״̬¡£Cookies×îµäÐ͵ÄÓ¦ÓÃÊÇÅж¨×¢²áÓû§ÊÇ·ñÒѾ­µÇ¼ÍøÕ¾£¬Óû§¿ÉÄÜ»áµÃµ½Ìáʾ£¬ÊÇ·ñÔÚÏÂÒ»´Î½øÈë´ËÍøվʱ±£ÁôÓû§ÐÅÏ¢ÒÔ±ã¼ò»¯µÇ¼ÊÖÐø£¬ÕâЩ¶¼ÊÇCookiesµÄ¹¦Óá£ÁíÒ»¸öÖØÒ ......

PHP±àÒëÅäÖúÍÅäÖÃÎļþ˵Ã÷


PHP°²×°ÅäÖÃ˵Ã÷
Ò»¡¢Èí¼þÏÂÔØ
PHP5.3.0:http://cn2.php.net/get/php-5.3.0.tar.gz/from/this/mirror
Pear£ºhttp://de.pear.php.net/get/PEAR-1.9.0.tar
Mm£ºftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
¶þ¡¢»·¾³¼ì²é
ÒÑ°²×°Apache2.2.13(/usr/local/apache/),mm-1.4.2£¨/usr/local/mm/£©
rpm -qa|grep mcrypt ......

PHP·þÎñÆ÷¶Ëͨ¹ýÃüÃû¹ÜµÀÓëC/C++³ÌÐòͨÐÅ

ÔÚÕ⼸ÌìµÄ¹¤×÷¹ý³ÌÖУ¬ÐèҪʵÏÖPHPÔÚ·þÎñÆ÷¶ËÄÜÓëÆäËû³ÌÐòͨÐÅ¡£ºÍÀϺÎÁ©ÈËÑо¿ÁË°ëÌ죬ÖÕÓÚ´óÖÂŪ³öÁËÒ»¸öÓÃWINDOWSµÄÃüÃû¹ÜµÀͨÐŵķ½·¨¡£
Óм¸µãÐèҪעÒâµÄ£º
PHP·þÎñÆ÷¶ËÎÒÃÇÿ´Î¶¼ÊÇÖØйҽÓÃüÃû¹ÜµÀ¡££¨ÕâÑùд£¬PHP¶Ë´úÂëÁ¿¼«ÆäÉÙ£¬¶øÇÒÒ²ºÜ·½±ã¡££©
ÄÇôÎÒÃÇÓÃC/C++дµÄÃüÃû¹ÜµÀ·þÎñÆ÷ÔòÐèҪÿ´ÎͨÐŶ¼´´½¨Ò»´Î¹ ......

PHP½»»»Êý×éÖеÄÔªËغÍÖµ

/*
author: yangyu@sina.cn
description: ½»»»Êý×éÖÐÁ½¸öÔªËصÄλÖã¬ÔªËØ°üÀ¨keyºÍvalue£¬¾ßÌåÓ÷¨¼ûÏÂÃæµÄÀý×Ó
*/
$arr = array(11=>'a',22=>'b',33=>'c',44=>'d');
$res = array_exchange($arr, 11 ,33);
//example:
echo '<pre>';print_r ($res);echo '</pre>';
function array_excha ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ