Home | Data Center | Contact US | Login

Á¦¸ñ APM(apache + php + mysql) utf-8 ±¸Çö
÷ºÎÆÄÀÏ APM(apache + php + mysql) utf-8 ±¸Çö.pdf ÀÛ¼ºÀÏ 2007-02-22 14:29:33
ÀÛ¼ºÀÚ : ±â¼úÁö¿øºÎ ±è »ï ¼ö kiss@nextline.net

APM(apache + php + mysql) utf-8 ±¸Çö

±¸Çöȯ°æ
OS : CentOS 4.3
Apache : 1.3.34
Php : 4.4.2
Mysql : 4.1.18

( 1 ) utf-8 º¯°æÀü ij¸¯Åͼ ȮÀÎ

vi ¿¡µðÅÍ »ç¿ë¹ý

»ç¿ëÇü½Ä : vi [¿É¼Ç] [»ý¼ºÇÒ ÆÄÀϸí/ÆíÁýÇÒ ÆÄÀϸí]

vi ¿¡µðÅÍ´Â ÀԷ¸ðµå, ¸í·É¸ðµå, ½ÇÇà¸ðµå·Î ±¸ºÐµË´Ï´Ù.

ÀԷ¸ðµå : vi ÆíÁýÈ­¸é¿¡¼­ ¹®ÀÚ¸¦ ÀÔ·ÂÇÒ ¼ö ÀÖ´Â ¸ðµå·Î¼­ ÀԷ¸ðµå·Î ÁøÀÔÇϱâ À§Çؼ­´Â i, a, o, I, A, O, RµîÀÌ ÀÖ½À´Ï´Ù. Áï Ãʱâ vi ÆíÁý±â ¸ðµå´Â ¸í·É¾î ¸ðµå·Î ÁøÀÔÀ» Çϱ⶧¹®¿¡ ¹®ÀÚ¸¦ ÀÔ·ÂÇϱâ Àü¿¡ ¾ÕÀÇ ´ÜÃàÅ°Áß Çϳª¸¦ ¸ÕÀú ÀÔ·ÂÇØ¾ß ¿øÇÏ´Â ¹®ÀÚ¸¦ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.
¸í·É¸ðµå : Ä¿¼­À̵¿/¹®ÀÚ»èÁ¦/¹®ÀÚ(¿­)±³Ã¼/¹®ÀÚ¿­°Ë»ö µîÀ» ÇÒ¼ö ÀÖ´Â ¸ðµå·Î¼­ ÀԷ¸ðµå¿¡¼­ ÆíÁýÀÌ ¿Ï·áµÇ¸é EscÅ°¸¦ ´­·¯ ¸í·É¸ðµå·Î ÁøÀÔÇÏ¸é µË´Ï´Ù.

x : vi ¸í·É¸ðµå¿¡¼­ Ä¿¼­À§Ä¡ÀÇ ÇÑ ¹®ÀÚ »èÁ¦
dw : vi ¸í·É¸ðµå¿¡¼­ Ä¿¼­À§Ä¡ÀÇ ÇÑ´Ü¾î »èÁ¦
dd : vi ¸í·É¸ðµå¿¡¼­ Ä¿¼­À§Ä¡ÀÇ Çà »èÁ¦
Ndd : vi ¸í·É¸ðµå¿¡¼­ Ä¿¼­À§Ä¡ÀÇ ¿©·¯Çà µ¿½Ã »èÁ¦

½ÇÇà¸ðµå : Ưº°ÇÑ ¸í·É¾î¸¦ ½ÇÇàÇÏ´Â ¸ðµå·Î¼­ ¸í·É¾î¸ðµå¿¡¼­ ":"(ÄÝ·Ð)¸¦ ´©¸£¸é vi È­¸é ÇÏ´Ü ÁÂÃø¿¡ vi Ư¼ö¸í·É¾î¸¦ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.

½ÇÇà¸ðµåÀÇ ÀϹÝÀûÀ¸·Î ¾²À̴ Ư¼ö ¸í·É¾î
q : ¼öÁ¤ ÀÛ¾÷ÀÌ ÀÌ·ç¾îÁöÁö ¾ÊÀº »óÅ¿¡¼­ vi ÆíÁý±â¿¡¼­ ºüÁ®³ª¿É´Ï´Ù.
q! : ¼öÁ¤ ÀÛ¾÷ÀÌ ÀÌ·ç¾îÁø ºÎºÐÀ» Àû¿ë½ÃÅ°Áö ¾Ê°í vi ÆíÁý±â¸¦ °­Á¦·Î ºüÁ®³ª¿É´Ï´Ù.
w : ¼öÁ¤µÈ ÀÛ¾÷À» ÀúÀåÇÕ´Ï´Ù.
wq : ¼öÁ¤µÈ ÀÛ¾÷À» ÀúÀåÇÏ°í vi ÆíÁý±â¿¡¼­ ºüÁ®³ª¿É´Ï´Ù.

Ãʱ⠸í·É¾î¸ðµå -> ÀԷ¸ðµåÁøÀÔ -> ÆíÁý -> ¸í·É¾î¸ðµå -> ½ÇÇà¸ðµå -> Á¾·á

¨ç php Á¤º¸¸¦ È®ÀÎÇϱâ À§ÇÏ¿© vi ¿¡µðÅ͸¦ ÀÌ¿ëÇÏ¿© php_test.php ÆÄÀÏÀ» »ý¼ºÇÕ´Ï´Ù.
[root@nextline ~]# vi /usr/local/apache/htdocs/php_test.php


¨è <? phpinfo(); ?> ¹®À» Ãß°¡ÇÕ´Ï´Ù.


¨é http://ÇØ´çip/php_test.php È®ÀÎÈ­¸é
ÇØ´ç ip : apmÀÌ ¼³Ä¡µÈ ÇöÀç ¼­¹öÀÇ ip¸¦ ÀÔ·ÂÇÏ¿© Áֽñ⠹ٶø´Ï´Ù.

À¥ ºê¶ó¿ìÀú¿¡ À§ ÁÖ¼Ò¸¦ ÀÔ·ÂÇÏ½Ã¸é ¾Æ·¡ÀÇ È­¸éÀÌ ³ª¿À¸ç php, Zend, GD, Apache,
Mysql, ¶óÀ̺귯¸® µîÀÌ Á¤»óÀûÀ¸·Î ¿¬µ¿µÈ Á¤º¸¸¦ º¸¿©ÁÝ´Ï´Ù.

PHP Core ºÎºÐ È®ÀÎ
Default_charset


HTTP Headers Information
Content-Type


¨ê Mysql ij¸¯Åͼ ȮÀÎ
[root@nextline ~]# mysql -u root -p
Enter password:
mysql> use mysql;
mysql> show variables like 'c%';


( 1 ) apache ȯ°æÆÄÀÏ ÆíÁý

¨ç httpd.conf ÆíÁý
[root@nextline ~]# vi /usr/local/apache/conf/httpd.conf


¨è AddDefaultCharset UTF-8 ¸¦ Ãß°¡ÇÕ´Ï´Ù.


( 2 ) php ȯ°æÆÄÀÏ ÆíÁý

¨ç php.ini ÆíÁý
[root@nextline ~]# vi /usr/local/lib/php.ini


¨è default_charset = "utf-8" ¸¦ Ãß°¡ÇÕ´Ï´Ù.


( 3 ) mysql ȯ°æÆÄÀÏ ÆíÁý

¨ç [root@nextline ~]# vi /etc/my.cnf


¨è [mysqld] ¿µ¿ª¿¡ ¾Æ·¡¿Í °°ÀÌ Ãß°¡ÇÕ´Ï´Ù.

init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci


¨é [client] ¿µ¿ª¿¡ ¾Æ·¡ ºÎºÐÀ» Ãß°¡ ÇÕ´Ï´Ù.
Default-character-set=utf8


¨ê [mysql] ¿µ¿ª¿¡ ¾Æ·¡ ºÎºÐÀ» Ãß°¡ÇÕ´Ï´Ù.
Default-character-set=utf8


( 4 ) apache, mysql ¼­ºñ½º Àç½ÃÀÛ

¨ç apache ¼­ºñ½º Àç½ÃÀÛ
[root@nextline ~]# /usr/local/apache/bin/apachectl restart


¨è mysql ¼­ºñ½º Àç½ÃÀÛ
[root@nextline ~]# /usr/local/mysql/bin/mysqladmin -u root -p shutdown
Enter password:
[root@nextline ~]# /usr/local/mysql/bin/mysqld_safe &


¨é Æ÷ƮȮÀÎ

netstat ¸í·É¾î »ç¿ë¹ý
¸®´ª½º¼­¹ö ¶ó¿ìÆÃÅ×À̺í È®Àΰú ³×Æ®¿÷ ¿¬°á »óŵîÀ» È®ÀÎÇÒ ¼ö ÀÖ´Â ¸í·É¾îÀÔ´Ï´Ù.

»ç¿ëÇü½Ä : netstat [¿É¼Ç]
-a ¿É¼Ç : --all °ú °°À¸¸ç listen µÇ´Â ¼ÒÄÏÁ¤º¸¿Í listen µÇÁö ¾Ê´Â ¼ÒÄÏÁ¤º¸ ¸ðµÎ¸¦ º¸¿©ÁÝ´Ï´Ù.
-n ¿É¼Ç : --numeric °ú °°À¸¸ç 10 Áø¼öÀÇ ¼öÄ¡Á¤º¸·Î °á°ú¸¦ Ãâ·Â ÇÕ´Ï´Ù.
-p ¿É¼Ç : --program °ú °°À¸¸ç ½ÇÇàµÇ°íÀÖ´Â °¢ ÇÁ·Î±×·¥°ú PID Á¤º¸¸¦ Ãâ·Â ÇÕ´Ï´Ù.
¡°|¡± ÆÄÀÌÇÁ : ¾ÕÀÇ netstat -anp ÇÑ °á°ú¸¦ ±×´ë·Î grep¿¡°Ô ³Ñ°ÜÁÖ´Â °Ì´Ï´Ù. grep´Â ¾î¶² ÆÐÅÏ¿¡ ¸Â´Â °ÍÀ» »Ì¾Æ³»´Â ¿ªÇÒÀ» ÁÖ·Î Çϴµ¥ ¾Õ¿¡¼­ ³Ñ¾î ¿Â netstat Á¤º¸Áß listenµÇ´Â ¼ÒÄÏÁ¤º¸¸¸ Ãâ·ÂÇÕ´Ï´Ù.

[root@nextline ~]# netstat -anp | grep LISTEN
Apache ±âº»Æ÷Æ® : 80 Mysql ±âº»Æ÷Æ® : 3306


( 5 ) utf-8 ij¸¯Åͼ Àû¿ë È®ÀÎ

¨ç phpinfo
PHP Core


¨è HTTP Headers Information
Content-Type


¨é Mysql ij¸¯Åͼ ȮÀÎ
[root@nextline ~]# mysql -u root -p
Enter password:
mysql> use mysql;
mysql> show variables like 'c%';

  qmail ¼³Ä¡
  apache logrotated ¼³Á¤





ȸ»ç¼Ò°³ °³ÀÎÁ¤º¸Ãë±Þ¹æħ ÀÌ¿ë¾à°ü À̸ÞÀÏÁÖ¼Ò ¹«´Ü¼öÁý°ÅºÎ CONTACT US IDC ¾àµµ
ȸ»ç¼Ò°³ °³ÀÎÁ¤º¸Ãë±Þ¹æħ ÀÌ¿ë¾à°ü À̸ÞÀÏÁÖ¼Ò ¹«´Ü¼öÁý°ÅºÎ CONTACT US IDC ¾àµµ ȸ»ç¼Ò°³ °³ÀÎÁ¤º¸Ãë±Þ¹æħ ÀÌ¿ë¾à°ü À̸ÞÀÏÁÖ¼Ò ¹«´Ü¼öÁý°ÅºÎ CONTACT US IDC ¾àµµ