deepin20安装多版本php

2020-10-29 PHP 1240

先安装php7.3

./configure --enable-fpm --with-libxml-dir --with-openssl-dir --with-pcre-dir --with-zlib --enable-bcmath --with-curl --enable-exif --with-gd --with-webp-dir --with-jpeg-dir --with-png-dir --with-zlib --with-freetype-dir --with-mysqli --with-pdo-mysql --enable-zip --enable-mysqlnd --with-iconv --enable-mbstring

1. 错误configure: error: cURL version 7.15.5 or later is required to compile php with cURL support

sudo apt install libcurl4-gnutls-dev

2. 错误 configure: error: webp/decode.h not found

sudo apt install libwebp-dev

3. 错误configure: error: jpeglib.h not found

sudo apt install libgd-dev

4. 错误configure: error: freetype-config not found.

查看:解决方法

5. 错误configure: error: Please reinstall the libzip distribution

sudo apt install libzip-dev

6. 错误configure: error: Cannot find OpenSSL's <evp.h>

sudo apt install libssl-dev

再安装php7.4

注意:--prefix

./configure --prefix=/usr/local/php74 --enable-fpm --with-openssl --with-zlib --enable-bcmath --with-curl --enable-exif --enable-gd --with-webp --with-jpeg --with-zlib --with-freetype --with-mysqli --with-pdo-mysql --with-zip --enable-mysqlnd --with-iconv --enable-mbstring --with-xmlrpc

1. 错误configure: error: Package requirements (sqlite3 > 3.7.4) were not met:No package 'sqlite3' found

sudo apt install libsqlite3-dev

2. 错误configure: error: Package requirements (oniguruma) were not met:No package 'oniguruma' found

sudo apt install libonig-dev

安装php5.6

** 同样需要修改configure文件的freetype部分,然后执行以下

./configure --prefix=/usr/local/php56 --enable-fpm --with-libxml-dir --with-pcre-regex --with-zlib --enable-bcmath --enable-exif --with-pcre-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --with-mhash --with-mysqli --with-pdo-mysql --enable-opcache --enable-pcntl --enable-soap --enable-sockets --with-xmlrpc --enable-zip --with-libzip --enable-mysqlnd --with-iconv --enable-mbstring

** 单独安装curl支持

wget https://curl.se/uploads/article/curl-7.74.0.tar.gz
tar -zxvf curl-7.74.0.tar.gz
cd curl-7.74.0
./configure --prefix=/opt/curl-7.74.0
sudo make && sudo make install

** 低版本php与openssl高版本不兼容,可能需要单独安装openssl

wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
tar -zxvf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
./config shared --prefix=/opt/openssl-1.0.2k --openssldir=/opt/openssl-1.0.2k/ssl
sudo make && sudo make install

** 安装完成,需要额外安装openssl和curl扩展

cd ext/curl
/usr/local/php56/bin/phpize
./configure --with-curl=/opt/curl-7.74.0 --with-php-config=/usr/local/php56/bin/php-config
sudo make && sudo make install
[php.ini]
extension=curl.so
cd ext/openssl
mv config0.m4 config.m4
/usr/local/php56/bin/phpize
./configure --with-openssl=/opt/openssl-1.0.2k --with-php-config=/usr/local/php56/bin/php-config
sudo make && sudo make install
[php.ini]
extension=openssl.so

** php5.6的扩展使用igbinary 2版本和redis 4.3版本

0