linux 安装多个php
官网下载需要的版本:https://www.php.net/downloads.php
# 下载7.4 wget https://www.php.net/distributions/php-7.4.32.tar.gz # 解压 tar -xzvf php-7.4.32.tar.gz cd php-7.4.32 ./configure --prefix=/usr/local/php74 --exec-prefix=/usr/local/php74 --bindir=/usr/local/php74/bin --sbindir=/usr/local/php74/sbin --includedir=/usr/local/php74/include --libdir=/usr/local/php74/lib/php --mandir=/usr/local/php74/php/man --with-config-file-path=/usr/local/php74/etc --with-mcrypt=/usr/local/libmcrypt --with-mhash --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-gd --with-iconv --with-zlib --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-fpm --without-gdbm --disable-fileinfo --enable-opcache=no make && make install cd /usr/local/php74/etc
cp php-fpm.conf.default php-fpm.conf # 进入 cd /usr/local/php74/etc/php-fpm.d cp www.conf.default www.conf vim www.conf # 将listen 端口9000改为未被占用的端口 listen = 127.0.0.1:9001
# 修改运行用户及用户组
user = www
group = www
运行:
/usr/local/php74/sbin/php-fpm