日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php7 libiconv,CentOS 7下编译libiconv

發布時間:2023/12/10 php 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php7 libiconv,CentOS 7下编译libiconv 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

libiconv組件安裝好了可以讓我們php支持iconv函數了,這個函數的作用就是字符編碼強制轉換了,下面和111cn小編一起來看一個Linux中安裝libiconv使php支持iconv函數的例子吧。

問題:

線上運行的lamp服務器,php不支持iconv函數。

解決方法:

安裝libiconv,重新編譯apache,使php支持iconv函數,實現utf-8和gb2312編碼的轉換。

具體步驟:

1、下載libiconv

cd /usr/local/src

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz #下載

2、安裝libiconv

cd /usr/local/src

tar zxvf libiconv-1.14.tar.gz #解壓

cd libiconv-1.14 #進入安裝目錄

./configure –prefix=/usr/local/libiconv #配置

make #編譯

make install #安裝

3、重新編譯php

查找系統之前的php編譯參數

cd /usr/local/php/bin #進入php安裝目錄

./php -i |more #查看php編譯參數

如下:

‘–with-pdo_sqlite=shared’ ‘–enable-bcmath=shared’ ‘–enable-ftp=shared’ ‘–enable-mbstring=shared’ ‘–with-iconv=shared’ ‘–enable-sockets=shared’ ‘–enable-zip’ ‘–enable-soap=s

hared’ ‘–with-openssl’ ‘–with-zlib’ ‘–with-curl=shared’ ‘–with-gd=shared’ ‘–with-jpeg-dir’ ‘–with-png-dir’ ‘–with-freetype-dir’ ‘–with-mcrypt=shared’ ‘–with-mhash=shared’ ‘–with-mysql=/ho

me/server/mysql’ ‘–with-mysqli=/home/server/mysql/bin/mysql_config’ ‘–with-pdo-mysql=/home/server/mysql/bin/mysql_config’ ‘–without-pear’ ‘–with-libdir=lib64’

對參數進行修改:

如下

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-apxs2=/usr/local/apache/bin/apxs –with-gettext=shared –with-sqlite=shared –with-pdo_sqlite=shared –enable-bcmath=shared –enable-ftp=shared –enable-mbstring=shared –with-iconv-dir=/usr/local/libiconv –enable-sockets=shared –enable-zip –enable-soap=shared –with-openssl –with-zlib –with-curl=shared –with-gd=shared –with-jpeg-dir –with-png-dir –with-freetype-dir –with-mcrypt=shared –with-mhash=shared –with-mysql=/home/server/mysql –with-mysqli=/home/server/mysql/bin/mysql_config –with-pdo-mysql=/home/server/mysql/bin/mysql_config –without-pear –with-libdir=lib64

備注:修改部分

取消原來的–with-iconv=shared

替換為:–with-iconv-dir=/usr/local/libiconv

取消參數兩邊的單引號

其它不變

cd /usr/local/src/php #進入php安裝包目錄(注意php版本要和之前一樣)

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-apxs2=/usr/local/apache/bin/apxs –with-gettext=shared –with-sqlite=shared –with-pdo_sqlite=shared –enable-bcmath=shared –enable-ftp=shared –enable-mbstring=shared –with-iconv-dir=/usr/local/libiconv –enable-sockets=shared –enable-zip –enable-soap=shared –with-openssl –with-zlib –with-curl=shared –with-gd=shared –with-jpeg-dir –with-png-dir –with-freetype-dir –with-mcrypt=shared –with-mhash=shared –with-mysql=/home/server/mysql –with-mysqli=/home/server/mysql/bin/mysql_config –with-pdo-mysql=/home/server/mysql/bin/mysql_config –without-pear –with-libdir=lib64 #配置

make #編譯

make install #安裝

4、重啟apache使設置生效

service httpd restart #重啟

故障解決!

學習時的痛苦是暫時的 未學到的痛苦是終生的

原創文章,作者:大眾源碼,如若轉載,請注明出處:https://www.dzpc.net/network-digest/789

總結

以上是生活随笔為你收集整理的php7 libiconv,CentOS 7下编译libiconv的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。