PHP添加mbstring擴充庫

來源:互聯網
上載者:User
一、Linux主機安裝mbstring擴充庫指南(源碼安裝)

以下命令在命令列下輸入:

1、用cd命令進入php的原始碼目錄下的etc/mbstring目錄下,如“/src/php5.2.5”,即“cd /src/php5.2.5”;

2、執行

#/usr/local/php/bin/phpize (假設php安裝在/usr/local/php目錄下)

3、執行

#./configure --with-php-config=/usr/local/php/bin/php-config

4、執行make && make install

5、之後系統會提示你mbstring.so檔案所在的目錄。根據php.ini中指示的extension_dir指向的目錄中,將其複製過去.或將 mbstring.so複製到/usr/local/php/ext目錄下,在手配置參extension_dir="/usr/local/php /ext"指向mbstring.so所在目錄.

6、修改php.ini,添加一句extension=mbstring.so

然後重啟apache:運行 /service httpd restart即可完成安裝。

二、Linux主機安裝mbstring擴充庫指南(rpm安裝)

如果你用的是linux內建的apache+php+mysql

命令:

#rpm -q php (得到php的版本號碼)

然後下載php-mbstring:

注意php-mbstring-4.3.9-3.15.i386.rpm這裡的版本號碼是可以更改的,只需要更改為你的php版本號碼就可以

安裝:

#rpm -ivh php-mbstring-4.x.x-x.xx.i386.rpm

然後重啟apache就可以了

三、設定 

PHP的設定檔案為/etc/php.ini。在這個例子中,以UTF-8編碼為例進行設定。  

#vi php.ini

把輸出處理常式設為mbstring對應。

;output_handler =

--> output_handler = "mb_output_handler"

設定文字集為UTF-8。

;default_charset = "iso-8859-1"

--> default_charset = "UTF-8"

設定mbstring的語言為Chinese

;mbstring.language = Japanese

--> mbstring.language = Chinese

設定mbstring的內部編碼為UTF-8。

;mbstring.internal_encoding = EUC-JP

--> mbstring.internal_encoding = UTF-8

設定mbstring的輸入文字編碼為自動判別方式。

;mbstring.http_input = auto

--> mbstring.http_input = auto

把mbstring輸出文字編碼設為UTF-8。

;mbstring.http_output = SJIS

--> mbstring.http_output = UTF-8

啟用mbstring的文字編碼自動變換方式。

;mbstring.encoding_translation = Off

mbstring.encoding_translation = On

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.