PHP ÔÚ¶à¸ö½ø³ÌÖ®¼ä¹²Ïí±äÁ¿
Ò»£º½éÉÜ£º
Óû§ÔÚ·ÃÎÊÒ»¸öWebÓ¦ÓóÌÐòʱ(ÀýÈç·ÃÎÊwww.imop.us)£¬Èç¹ûÄÜÔÚWeb·þÎñÆ÷ÉÏ´æ´¢Óû§»ò»á»°µÄÌض¨Êý¾Ý£¬´Ó¶øÿ´ÎÇëÇóÍøҳʱÄܺÜÈÝÒ׵طÃÎÊÕâЩÊý¾Ý½«·Ç³£ÓÐÓᣴ洢µÄ¿ÉÒÔÊÇÓйØÓû§¡¢Óû§Ê×Ñ¡ÏîµÄÐÅÏ¢£¬»òÕßÊÇÓëÓ¦ÓóÌÐòÏà¹ØµÄÊý¾Ý¡£Óû§Ã¿´ÎÇëÇó°üº¬session_start()º¯Êýµ÷ÓõÄÍøҳʱ£¬·þÎñÆ÷»á¿ªÊ¼Ò»¸öнø³Ì£¨»òÖØÓÃÒ»¸ö¿ÕÏнø³Ì£©£¬PHPÒýÇ潫ÔÚ²éѯ×Ö·û´®»òcookieÊý¾ÝÖвéÕÒÒ»¸ö»á»°ID¡£Õâ»á»ñÈ¡µ½Òѱ£´æµÄ»á»°Êý¾Ý£¬²¢½¨Á¢$_SESSIONÊý×é¡£
$_SESSIONÊÇÒ»¸ö³¬È«¾Ö±äÁ¿£¬¿ÉÒÔ´ÓÈκδúÂë¶ÎÖ±½Ó·ÃÎÊ¡£Èç¹û»á»°ÊǻµÄ£¬¿ÉÒÔ´Ó$_SESSIONÊý×é»ñÈ¡¡¢Ôö¼Ó¡¢¸üкÍɾ³ýÖµ¡£ÕâÓë´¦ÀíÈκÎÆäËû±äÁ¿ÊÇÀàËƵġ£ÒýÇæ»áÔڽű¾½áÊøʱ×Ô¶¯±£´æÊý×éµÄÖµ£¬³ý·ÇÒòΪ´íÎóÒì³£ÖÐÖ¹¡£»á»°Êý¾ÝÎļþ»áËø¶¨£¬ÒÔ±ÜÃâ¶à¸ö½ø³Ìͬʱ·ÃÎÊ£¨Ð´£©ÏàͬµÄÊý¾Ý¡£Èç¹û½Å±¾Ö´ÐеÄʱ¼äºÜ³¤£¬»òÕßÒª´Óͬһ¸ö·þÎñÆ÷¼ÓÔضà¸öÖ¡£¬¿ÉÒÔÓÅ»¯Ó¦ÓóÌÐò£¬Ê¹ÓÃsession_write_close()£¬¸Ãº¯ÊýûÓзµ»ØÖµ£¬±ðÃû£¨session_commit()£©¹Ø±Õ»á»°Êý¾ÝÎļþ¡£²»ÂÛʹÓÃÆäÖÐÄÄÒ»¸öÃüÁ֮ºó¶¼²»ÄÜÔÙÏò$_SESSIONÊý×éÔö¼ÓеÄÖµ¡£
¹²ÏíÄÚ´æÊÇÔÚ½ø³ÌÖй²ÏíÊý¾ÝµÄÁíÒ»ÖÖ°ì·¨¡£Á½¸ö½ø³ÌͬʱÔËÐÐʱ£¨¿ÉÄÜÓɲ»Í¬µÄ¿Í»§Æô¶¯£©£¬¾Í¿ÉÒÔʹÓù²ÏíÄÚ´æ¡£ÔÚ´ó¶àÊýÇé¿öÏ£¬¹²ÏíÄÚ´æ±È¹²ÏíÎļþ»òÊý¾Ý¿â±íµÄËٶȸü¿ì¡£ÔÚPHPÖÐʹÓù²ÏíÄÚ´æʱ£¬±ØÐëʹÓèCenable¨Cshmop²ÎÊý±àÒ롣ʹÓù²ÏíÄÚ´æʱ£¬ÒªÇó½ø³ÌÊdz־õģ¬ÈçApacheÄ£¿é¡¢IIS ISAPI»òPHP-GTKÓ¦ÓóÌÐò¡£ÀýÈçÔÚLinuxÏÂMySQLµÄÃüÁ
ʹÓÃps aux | grep mysql
¿ÉÒÔ¿´µ½
/usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/data/mysql/mysql.sock
<?xml:namespace prefix = o />
¶ÔÁË£¬ÕâÀïÎÒҪ˵һÏÂMySQLµÄÅäÖÃÎļþµÄλÖã¬Æð³õÎÒÓеã㣬¾ÍÊǸտªÊ¼ÅªLinuxµÄʱºò¾ÍûÕÒµ½my.cnf
ÔÚunix»·¾³Ï£º
1. /etc/my.cnf
2. DATADIR/my.cnf
3. ~/.my.cnf
ÔÚWindows»·¾³£º
1. %SystemRoot%/my.ini
2. c:\my.cnf
SockÎļþÒ»°ãĬÈÏдÔÚ/tmp/mysql.sock Ŀ¼ÀïÃ棬Ҳ¿ÉÒÔµ¥¸öÖ¸¶¨sockÎļþ¡£ÔÚÃüÁîÐÐÏÂÁ¬½ÓÐèҪд²ÎÊý
Mysql ¨Curoot ¨Ch127.0.0.1 ¨Cp ¨CS ¸úsockÎļþ·¾¶¡£
¶þ£º½â¾öº¯Êý£º
PhpÆäʵÓÐÁ½Ì×ʹÓù²ÏíÄÚ´æµÄº¯Êý£¨System V IPC¡¢shmop£©¡£
Ò»Ì×ÊÇSystem V IPCº¯ÊýµÄ·â×°£¬ÁíÒ»Ì×ÊÇshmop¡£ÕâÁ½¸ö¶¼ÎÞÐè°²×°Íⲿ¿âÎļþ¡£Ç°ÕßÖ»ÄÜÔÚLinuxÏÂʹÓ㬶øÇÒҪʹÓÃËüµÄ»°£¬ÔÚ°²×°phpµÄʱºòÒª¼ÓÉϨCenable-sysvshmÑ¡Ïî¡£¶øºóÕßÔÚlinuxºÍwindows£¨win2kÖ®ºóµÄϵͳ£¬win98²»Ö§³Ö£©¶¼¿ÉÒÔʹÓ㬵«ÔÚwindowsµÄʱºò£¬Ö»ÓÐÔÚphpÊÇISAPIÔËÐÐģʽ²ÅÄÜÕý³£¹¤×÷£¬ÔÚ°²×°phpµÄʱºòÒª¼ÓÉϨCenable-shmop¡£
System V IPC º¯Êý£º
shm_attach():´ò¿ª½¨Á¢¹²ÏíÄÚ´æ¿Õ¼ä¡£
shm_detach():ÖÐÖ¹¹²ÏíÄÚ´æ¿Õ¼äÁ´½Ó¡£
shm_remove():Çå³ýÄÚ´æ¿Õ¼ä¡£
shm_put_var():¼ÓÈë»ò¸üÐÂÄÚ´æ¿Õ¼äÖеıäÁ¿¡£
shm_get_var():È¡µÃÄÚ´æ¿Õ¼äÖÐÖ¸¶¨µÄ±äÁ¿¡£
shm_remove_var():ɾ³ýÄÚ´æ¿Õ¼äÖÐÖ¸¶¨µÄ±äÁ¿¡£
Shmop º¯Êý
shmop_open():´ò¿ª»ò´´½¨Ò»¸öÄÚ´æ¿éÀ´¹²Ïí¡£
shmop_close():¹Ø±ÕÒ»¸ö¹²ÏíÄÚ´æ¿é¡£
shmop_delete():ɾ³ýÒ»¸ö¹²ÏíÄÚ´æ¿é¡£
shmop_read():´ÓÒ»¸ö¹²ÏíÄÚ´æ¿é¶ÁÈ¡Êý¾Ý¡£
shmop_write():½«Êý¾Ýдµ½Ò»¸ö¹²ÏíÄÚ´æ¿é¡£
shmop_size():µÃµ½Ò»¸ö¹²ÏíÄÚ´æ¿éµÄ´óС¡£
Èý£º×ܽ᣺
1. ÕâÁ½Ì׺¯Êý¶¼ÊǼòµ¥Ò×Óõģ¬shmopµÄΨһºÃ´¦ÊÇ¿ÉÒÔÔÚwindowsÏÂʹÓã¬ÔÚlinuxϵĻ°ÍƼöʹÓÃshm_*ÄÇÌ׺¯Êý£¬ÒòΪÄÇÌ׺¯ÊýÔÚ²åÈë¡¢¸üÐÂÒÔ¼°¶ÁÈ¡¹²ÏíÄÚ´æÀïÃæµÄ±äÁ¿Ï൱·½±ã£¬¶øshmopÐèÒª×Ô¼ºÀ´¹æ»®¹²ÏíÄÚ´æµÄ´æ´¢½á¹¹£¬Ó¦ÓÃÆðÀ´ÉÔ΢¸´ÔÓÒ»µã¡£
2. ÔÚʹÓÃshmopʱ£¬Èç¹ûʹÓÃÍê³ÉºóûÓнøÐÐshmop_delete()²Ù×÷£¬ÔòÏ´ζԹ²ÏíÄÚ´æ±äÁ¿ÖµµÄдÈë»áÓÐÎÊÌâ³öÏÖ£¬Èç¹ûÇ°´ÎдÈëµÄ³¤¶È¡µÏ´ÎдÈëµÄ³¤¶È£¬ÔòÖ»¸²¸ÇÇ°ÃæµÄ£¬¶àÓàµÄÄÚÈݱ£Áô¡£·´Ö®£¬Èç¹ûÇ°´ÎдÈëµÄ³¤¶È¡´Ï´ÎдÈëµÄ³¤¶È£¬Ôò¶àÓàµÄÄÚÈÝ»á×Ô¶¯×·¼Óµ½ºóÃæ¡£
3. ¹²ÏíÄÚ´æʱÐèÒªµÄkey¼°±äÁ¿¾ùΪintÀàÐÍ¡£
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ