/* */

linux系统同时安装php7.4 和 php8.2(php多版本共存)

分类:大杂烩 时间:2024-03-13 21:17 浏览:0 评论:0
0
php 7.4 已经存在了,nginx 也已经安装了,现在新安装 php 8.2,找到 php 源码包的下载地址:
https://www.php.net/downloads.php
选择 8.2 版本的最新地址:
wget https://www.php.net/distributions/php-8.2.14.tar.gz
tar -zxvf php-8.2.14.tar.gz
cd php-8.2.14
./configure --prefix=/usr/local/php8.2.14 --sysconfdir=/usr/local/php8.2.14/etc/  --enable-opcache --enable-session --enable-fpm  --with-mysqli --with-pdo-mysql=mysqlnd --with-pdo-sqlite --with-sqlite3 --with-gettext --enable-mbregex --enable-mbstring --enable-xml --with-iconv  --with-mhash --with-openssl --with-freetype --with-gd --enable-bcmath --enable-gd --enable-soap   --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib  --with-bz2  --with-readline --with-webp --with-jpeg --with-imap-ssl --enable-exif --with-ffi --with-zip --with-pcre-jit
报错:
checking for libxml-2.0 >= 2.9.0... no
configure: error: Package requirements (libxml-2.0 >= 2.9.0) were not met:
No package 'libxml-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
先查找看本地是否真的没有:
sudo find / -name libxml-2.0*
果真没找到,那就自己安装吧:
sudo apt install libxml2
sudo apt install libxml2-dev
又报错:
configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:
No package 'sqlite3' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables SQLITE_CFLAGS
and SQLITE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
执行:
sudo apt install libsqlite3-dev
又报错:
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
sudo apt install bzip2
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
bzip2 已经是最新版 (1.0.8-2)。
升级了 0 个软件包,新安装了 0 个软件包, 要卸载 0 个软件包,有 0 个软件包未被升级。
我已经安装了bzip2,应该是需要安装bzip2-dev,可是运行命令sudo apt-get install bzip2-dev 结果是:E: 无法定位软件包 bzip2-dev
最后在Ubuntu bzip2 package 发现该库在Ubuntu的真正名字是libbz2-dev,所以执行如下命令配置通过:
sudo apt-get install libbz2-dev
又报错:
configure: error: Package requirements (libffi >= 3.0.11) were not met:
No package 'libffi' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables FFI_CFLAGS
and FFI_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
执行:
sudo apt-get install libffi-dev
又报错:
checking for libpng... no
configure: error: Package requirements (libpng) were not met:
No package 'libpng' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables PNG_CFLAGS
and PNG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
执行:
sudo apt install libpng-dev
又报错:
checking for libwebp >= 0.2.0... no
configure: error: Package requirements (libwebp >= 0.2.0) were not met:
No package 'libwebp' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables WEBP_CFLAGS
and WEBP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
执行:
sudo apt install libpng-dev
又报错:
checking for libjpeg... no
configure: error: Package requirements (libjpeg) were not met:
No package 'libjpeg' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables JPEG_CFLAGS
and JPEG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
执行:
sudo apt install libjpeg-dev
又报错:
checking for oniguruma... no
configure: error: Package requirements (oniguruma) were not met:
No package 'oniguruma' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
执行:
sudo apt install libonig-dev
又报错:
configure: error: Please reinstall readline - I cannot find readline.h
执行:
sudo apt install libreadline-dev
又报错:
checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
No package 'libzip' found
No package 'libzip' found
No package 'libzip' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
执行:
sudo apt install libzip-dev
直到出现:
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE. By continuing this installation  |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+
Thank you for using PHP.
至此所有的错误总算都解决了。
执行:
make
......
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
clicommand.inc
directorygraphiterator.inc
directorytreeiterator.inc
invertedregexiterator.inc
phar.inc
pharcommand.inc
Build complete.
Don't forget to run 'make test'.
make test
sudo make install
yhm-docker@/webDefault/php-8.2.14$sudo make install
Installing shared extensions:     /usr/local/php8.2.14/lib/php/extensions/no-debug-non-zts-20220829/
Installing PHP CLI binary:        /usr/local/php8.2.14/bin/
Installing PHP CLI man page:      /usr/local/php8.2.14/php/man/man1/
Installing PHP FPM binary:        /usr/local/php8.2.14/sbin/
Installing PHP FPM defconfig:     /usr/local/php8.2.14/etc/
Installing PHP FPM man page:      /usr/local/php8.2.14/php/man/man8/
Installing PHP FPM status page:   /usr/local/php8.2.14/php/php/fpm/
Installing phpdbg binary:         /usr/local/php8.2.14/bin/
Installing phpdbg man page:       /usr/local/php8.2.14/php/man/man1/
Installing PHP CGI binary:        /usr/local/php8.2.14/bin/
Installing PHP CGI man page:      /usr/local/php8.2.14/php/man/man1/
Installing build environment:     /usr/local/php8.2.14/lib/php/build/
Installing header files:          /usr/local/php8.2.14/include/php/
Installing helper programs:       /usr/local/php8.2.14/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php8.2.14/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PDO headers:           /usr/local/php8.2.14/include/php/ext/pdo/
sudo mv /usr/local/php8.2.14/etc/php-fpm.conf.default /usr/local/php8.2.14/etc/php-fpm.conf
sudo mv /usr/local/php8.2.14/etc/php-fpm.d/www.conf.default /usr/local/php8.2.14/etc/php-fpm.d/www.conf
参考 php7.4 的配置文件,
cat /etc/php/7.4/fpm/pool.d/www.conf
更改 php-fpm 的配置文件
sudo vim /usr/local/php8.2.14/etc/php-fpm.d/www.conf
更改如下内容:
user = www-data
group = www-data
取消注释:
listen.owner = www-data
listen.group = www-data
listen 改为:
listen = /run/php/php-fpm.sock
sudo find / -name 'phpize'
/var/lib/dpkg/alternatives/phpize
/etc/alternatives/phpize
/usr/local/php8.2.14/bin/phpize
/usr/bin/phpize
sudo find / -name 'php-config'
/var/lib/dpkg/alternatives/php-config
/etc/alternatives/php-config
/usr/local/php8.2.14/bin/php-config
/usr/bin/php-config
php 8 环境重要配置文件:
phpize 文件:
/usr/local/php8.2.14/bin/phpize
php-config 文件:
/usr/local/php8.2.14/bin/php-config
php-fpm 文件位置:
/usr/local/php8.2.14/sbin/php-fpm
php 扩展目录:
/usr/local/php8.2.14/lib/php/extensions/no-debug-non-zts-20220829
php-fpm 配置文件位置:
/usr/local/php8.2.14/etc/php-fpm.conf
/usr/local/php8.2.14/etc/php-fpm.d/www.conf
php-fpm pid 文件位置:
run/php-fpm.pid
php.ini 文件位置:
/usr/local/php8.2.14/lib/php.ini
给 php 8 环境安装 mongodb 扩展:
1. 去官网下载 mongodb 扩展,地址:
https://pecl.php.net/package/mongodb
2. 下载保存到本地,解压,本次保存目录在:
/webDefault/mongodb-1.17.2
依次执行如下命令:
yhm-docker@/webDefault/mongodb-1.17.2$cd mongodb-1.17.2/
yhm-docker@/webDefault/mongodb-1.17.2/mongodb-1.17.2$sudo /usr/local/php8.2.14/bin/phpize
yhm-docker@/webDefault/mongodb-1.17.2/mongodb-1.17.2$sudo ./configure --with-php-config=/usr/local/php8.2.14/bin/php-config
yhm-docker@/webDefault/mongodb-1.17.2/mongodb-1.17.2$sudo make
yhm-docker@/webDefault/mongodb-1.17.2/mongodb-1.17.2$sudo make install
执行完会得到如下结果:
Installing shared extensions:     /usr/local/php8.2.14/lib/php/extensions/no-debug-non-zts-20220829/
执行:
yhm-docker@/webDefault/mongodb-1.17.2/mongodb-1.17.2$php -m|grep mongodb
mongodb
说明安装成功。
共存之后的启动管理文件分别为:
/etc/init.d/php7.4-fpm
内容如下:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          php7.4-fpm
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php7.4-fpm
# Description:       Starts The PHP FastCGI Process Manager Daemon
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=php-fpm7.4
CONFFILE=/etc/php/7.4/fpm/php-fpm.conf
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS="--daemonize --fpm-config $CONFFILE"
CONF_PIDFILE=$(sed -n 's/^pid[ =]*//p' $CONFFILE)
PIDFILE=${CONF_PIDFILE:-/run/php/php7.4-fpm.pid}
TIMEOUT=30
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
    ln -snf /usr/bin/php7.4 /etc/alternatives/php
    ln -sf /usr/bin/phpize7.4 /etc/alternatives/phpize
    ln -sf /usr/bin/php-config7.4 /etc/alternatives/php-config
        #service php8.2-fpm stop
    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running
    #   2 if daemon could not be started
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
        || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
        $DAEMON_ARGS 2>/dev/null \
        || return 2
    # Add code here, if necessary, that waits for the process to be ready
    # to handle requests from services started subsequently which depend
    # on this one.  As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
    #service php8.2-fpm stop
    # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred
    start-stop-daemon --stop --quiet --retry=QUIT/$TIMEOUT/TERM/5/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2
    # Wait for children to finish too if this is a daemon that forks
    # and if the daemon is only ever run from this initscript.
    # If the above conditions are not satisfied then add some other code
    # that waits for the process to drop all resources that could be
    # needed by services started subsequently.  A last resort is to
    # sleep for some time.
    start-stop-daemon --stop --quiet --oknodo --retry=0/30/TERM/5/KILL/5 --exec $DAEMON
    [ "$?" = 2 ] && return 2
    # Many daemons don't delete their pidfiles when they exit.
    rm -f $PIDFILE
    return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
    #service php8.2-fpm stop
    #
    # If the daemon can reload its configuration without
    # restarting (for example, when it is sent a SIGHUP),
    # then implement that here.
    #
    start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE --name $NAME
    return 0
}
case "$1" in
    start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    systemd-tmpfiles --remove --create /usr/lib/tmpfiles.d/php7.4-fpm.conf
    case "$?" in
        0)
        do_start
        case "$?" in
            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
            2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
        1) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
    stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
    status)
        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
        ;;
    reload|force-reload)
    log_daemon_msg "Reloading $DESC" "$NAME"
    do_reload
    log_end_msg $?
    ;;
    reopen-logs)
    log_daemon_msg "Reopening $DESC logs" $NAME
    if start-stop-daemon --stop --signal USR1 --oknodo --quiet \
        --pidfile $PIDFILE --exec $DAEMON
    then
        log_end_msg 0
    else
        log_end_msg 1
    fi
    ;;
    restart)
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
      0|1)
        do_start
        case "$?" in
            0) log_end_msg 0 ;;
            1) log_end_msg 1 ;; # Old process is still running
            *) log_end_msg 1 ;; # Failed to start
        esac
        ;;
      *)
        # Failed to stop
        log_end_msg 1
        ;;
    esac
    ;;
    *)
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
    exit 1
    ;;
esac
:
/etc/init.d/php8.2-fpm 文件内容如下:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          php8.2-fpm
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php8.2-fpm
# Description:       Starts The PHP FastCGI Process Manager Daemon
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/php8.2.14/sbin
DESC="PHP 8.2 FastCGI Process Manager"
NAME=php-fpm8.2
CONFFILE=/usr/local/php8.2.14/etc/php-fpm.conf
DAEMON=/usr/local/php8.2.14/sbin/php-fpm
DAEMON_ARGS="--daemonize --fpm-config $CONFFILE"
CONF_PIDFILE=$(sed -n 's/^pid[ =]*//p' $CONFFILE)
PIDFILE=${CONF_PIDFILE:-/run/php-fpm.pid}
TIMEOUT=30
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
    ln -snf /usr/local/php8.2.14/bin/php /etc/alternatives/php
    ln -sf /usr/local/php8.2.14/bin/phpize /etc/alternatives/phpize
    ln -sf /usr/local/php8.2.14/bin/php-config /etc/alternatives/php-config
        #service php7.4-fpm stop
    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running
    #   2 if daemon could not be started
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
        || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
        $DAEMON_ARGS 2>/dev/null \
        || return 2
    # Add code here, if necessary, that waits for the process to be ready
    # to handle requests from services started subsequently which depend
    # on this one.  As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
    #service php7.4-fpm stop
    # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred
    start-stop-daemon --stop --quiet --retry=QUIT/$TIMEOUT/TERM/5/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2
    # Wait for children to finish too if this is a daemon that forks
    # and if the daemon is only ever run from this initscript.
    # If the above conditions are not satisfied then add some other code
    # that waits for the process to drop all resources that could be
    # needed by services started subsequently.  A last resort is to
    # sleep for some time.
    start-stop-daemon --stop --quiet --oknodo --retry=0/30/TERM/5/KILL/5 --exec $DAEMON
    [ "$?" = 2 ] && return 2
    # Many daemons don't delete their pidfiles when they exit.
    rm -f $PIDFILE
    return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
    #
    # If the daemon can reload its configuration without
    # restarting (for example, when it is sent a SIGHUP),
    # then implement that here.
    #
    #service php7.4-fpm stop
    start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE --name $NAME
    return 0
}
case "$1" in
    start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    systemd-tmpfiles --remove --create /usr/lib/tmpfiles.d/php8.2-fpm.conf
    case "$?" in
        0)
        do_start
        case "$?" in
            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
            2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
        1) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
    stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
    status)
        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
        ;;
    reload|force-reload)
    log_daemon_msg "Reloading $DESC" "$NAME"
    do_reload
    log_end_msg $?
    ;;
    reopen-logs)
    log_daemon_msg "Reopening $DESC logs" $NAME
    if start-stop-daemon --stop --signal USR1 --oknodo --quiet \
        --pidfile $PIDFILE --exec $DAEMON
    then
        log_end_msg 0
    else
        log_end_msg 1
    fi
    ;;
    restart)
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
      0|1)
        do_start
        case "$?" in
            0) log_end_msg 0 ;;
            1) log_end_msg 1 ;; # Old process is still running
            *) log_end_msg 1 ;; # Failed to start
        esac
        ;;
      *)
        # Failed to stop
        log_end_msg 1
        ;;
    esac
    ;;
    *)
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
    exit 1
    ;;
esac
:
为 php 8.2 安装 xdebug 扩展:
找到 xdebug 的下载地址:https://pecl.php.net/package/xdebug
下载并安装:
yhm-docker@/webDefault$wget https://pecl.php.net/get/xdebug-3.3.1.tgz
yhm-docker@/webDefault$tar -zxvf xdebug-3.3.1.tgz
yhm-docker@/webDefault/xdebug-3.3.1$cd xdebug-3.3.1
yhm-docker@/webDefault/xdebug-3.3.1$phpize
yhm-docker@/webDefault/xdebug-3.3.1$./configure --with-php-config=/usr/local/php8.2.14/bin/php-config
yhm-docker@/webDefault/xdebug-3.3.1$sudo make
yhm-docker@/webDefault/xdebug-3.3.1$sudo make install
yhm-docker@/webDefault/xdebug-3.3.1$sudo vim /usr/local/php8.2.14/lib/php.ini #增加一行 extension=xdebug.so
yhm-docker@/webDefault/xdebug-3.3.1$php -m| grep xdebug
xdebug
至此 xdebug 扩展成功安装。
最近由于验证码图片显示不了,提示:PHP Fatal error: Call to undefined function imagettftext() 的错误,经搜索得知freetype是GD库的一部分,你装了GD不一定就支持freetype,很多人理解错误,freetype 不是一个独立的扩展,是附着在GD库上的。
freetype库相关知识补充
freetype库是一个完全免费开源的、高质量的且可移植的字体引擎,它提供统一的接口来访问多种字体格式文件,包括TrueType、OpenType、Type1、CID、CFF、Windows FON/FNT、X11 PCF等。
下面安装上 freetype ,步骤如下:
freetype 的下载地址
因为 php 8.2 是 2022年12月份推出来的,为了兼容考虑,本次不选择最新版本,下一个 2022 年的版本就行:
freetype-2.12.0.tar.gz
yhm-docker@/webDefault$wget https://download.savannah.gnu.org/releases/freetype/freetype-2.12.0.tar.gz
yhm-docker@/webDefault$tar -zxvf freetype-2.12.0.tar.gz
yhm-docker@/webDefault$cd freetype-2.12.0
yhm-docker@/webDefault/freetype-2.12.0$./configure --prefix=/usr/local/php8.2freetype
yhm-docker@/webDefault/freetype-2.12.0$sudo make
yhm-docker@/webDefault/freetype-2.12.0$sudo make install
yhm-docker@/webDefault/php-8.2.14/ext/gd$cd /webDefault/php-8.2.14/ext/gd
yhm-docker@/webDefault/php-8.2.14/ext/gd$make clean
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o -o -name \*.dep | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la      modules/* libs/*
rm -f ext/opcache/jit/zend_jit_x86.c
rm -f ext/opcache/jit/zend_jit_arm64.c
rm -f ext/opcache/minilua
yhm-docker@/webDefault/php-8.2.14/ext/gd$
yhm-docker@/webDefault/php-8.2.14/ext/gd$/usr/local/php8.2.14/bin/phpize
Configuring for:
PHP Api Version:         20220829
Zend Module Api No:      20220829
Zend Extension Api No:   420220829
yhm-docker@/webDefault/php-8.2.14/ext/gd$./configure -with-php-config=/usr/local/php8.2.14/bin/php-config --with-freetype=/usr/local/php8.2freetype
yhm-docker@/webDefault/php-8.2.14/ext/gd$sudo make
yhm-docker@/webDefault/php-8.2.14/ext/gd$sudo make install
Installing shared extensions:     /usr/local/php8.2.14/lib/php/extensions/no-debug-non-zts-20220829/
Installing header files:          /usr/local/php8.2.14/include/php/
yhm-docker@/webDefault/php-8.2.14/ext/gd$vim /usr/local/php8.2.14/lib/php.ini # 增加 extension=gd.so
yhm-docker@/webDefault/php-8.2.14/ext/gd$sudo service php8.2-fpm restart
本次操作失败。
1. 本站所有资源来源于用户上传或网络,仅作为参考研究使用,如有侵权请邮件联系站长!
2. 本站积分货币获取途径以及用途的解读,想在本站混的好,请务必认真阅读!
3. 本站强烈打击盗版/破解等有损他人权益和违法作为,请各位会员支持正版!
4. 大杂烩 > linux系统同时安装php7.4 和 php8.2(php多版本共存)

用户评论