此方法允许同时安装多个PHP版本。
安装:
$ sudo apt install autoconf build-essential curl libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline-dev libzip-dev openssl pkg-config zlib1g-dev libsqlite3-dev libonig-dev libpng-dev libfreetype6-dev freetype2-demos libjpeg-dev
$ ./configure --prefix=/var/www/php-7.4.6 --enable-mysqlnd --with-pdo-mysql --with-pdo-mysql=mysqlnd --enable-bcmath --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-mbstring --enable-phpdbg --enable-shmop --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-zip --with-zlib --with-curl --with-pear --with-openssl --enable-pcntl --with-readline --enable-gd --enable-calendar --with-freetype --with-jpeg
$ make
$ make install
配置php.ini:
$
cp php.ini-production /var/www/php-7.4.6/lib/php.ini
change follow line in php.ini:
pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock
zend_extension=opcache.so
配置php-fpm:
$ cd /var/www/php-7.4.6/etc;
$ cp php-fpm.conf.default php-fpm.conf
$ cp php-fpm.d/www.conf.default php-fpm.d/www.conf
change port from 9000 to 9001 in php-fpm.d/www.conf if you are running more than one php-fpm.
$ sudo /var/www/php-7.4.6/sbin/php-fpm
配置nginx:
location ~ ^/test/drupal9/.*\.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9001;
}
参考:
https://www.php.net/manual/en/install.unix.debian.php#122244
添加新评论