Centos7 安裝php7.3 並擴展 MySQL、postgresql


首先是安裝需要的擴展文件

yum -y install freetype-devel
yum -y install libpng-devel
yum -y install libjpeg-devel
yum -y install libcurl-devel
yum -y install libxml2-devel
yum -y install libXpm-devel
yum -y install openssl openssl-devel
yum -y install postgresql-devel

 


PHP當前最新版本是PHP7.3,今天在嘗試安裝的過程中報如下錯誤: system libzip must be upgraded to version >= 0.11, 根據提示我們可以清楚的知道是因為系統自帶的libzip版本低了,這里我們需要安裝最新的libzip

首先,卸載系統自帶的libzip

yum -y remove libzip-devel
然后從官網下載並編譯安裝

wget https://libzip.org/download/libzip-1.3.2.tar.gz
tar xvf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure
make && make install

 

如果是下載1.5.*以上版本,則需要采用如下安裝方式 提示需要cmake 3.1 以及以后版本

yum -y install cmake wget https://libzip.org/download/libzip-1.5.1.tar.gz
tar -zxvf libzip-1.5.1.tar.gz
cd libzip-1.5.1
mkdir build
cd build
cmake ..
make && make install

 

下面是配置編譯文件,可以根據需要添加減少擴展。

./configure --prefix=/application/php-7.3.8 --with-pgsql=shared --with-pdo-pgsql=shared --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-zlib-dir=/usr/local/zlib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype

或者寫成多行的:
./configure --prefix=/application/php-7.3.8 \
--with-pgsql=shared --with-pdo-pgsql=shared \
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg \
--with-freetype-dir=/usr/local/freetype \
--with-xpm-dir=/usr/ \
--with-zlib-dir=/usr/local/zlib \
--with-iconv \
--enable-libxml \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-opcache \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-curl \
--enable-ctype

最后就是安裝了 make 的時間稍微有點長。

make 
make install

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM