如何讓同一台 Apache 跟 php 同時使用 UTF-8 跟 Big5 ??
by 資訊藝術家 • 2009/04/16 • 系統相關 • 0 Comments
先在 Apache 的設定裡面加上以下的設定 ~~ 如兩個網站 111.com.tw 跟 222.com.tw
#vi /etc/httpd/conf/httpd.conf <VirtualHost *:80> DocumentRoot "/var/www/html/" ServerName 111.com.tw AddDefaultCharset Big5 <Directory "/var/www/html/"> allow from all Options FollowSymLinks MultiViews </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "/var/www/html/catalog/" ServerName 222.com.tw AddDefaultCharset UTF-8 <Directory "/var/www/html/catalog/"> allow from all Options FollowSymLinks MultiViews </Directory> </VirtualHost>
好了之後呢 ~~ 修改 /etc/php.ini
#vi /etc/php.ini 找到 default_charset = "xxxx" 在前面加註解 ";" 分號就可以了 ~~ #service httpd restart 重新啟動 apache