Home > Article > Backend Development > How to install multiple php versions in linux
How to install multiple PHP versions on Linux: first download different PHP source packages; then unzip them and install them in different directories; finally modify the port number monitored by "php-fpm".
Recommended: "PHP Video Tutorial"
Thinking:
Download different php source code packages, unzip them and install them in different directories. Modify the port number for php-fpm monitoring
php installation configuration parameters:
./configure --prefix=/usr/local/php71 --exec-prefix=/usr/local/php71 --bindir=/usr/local/php71/bin --sbindir=/usr/local/php71/sbin --includedir=/usr/local/php71/include --libdir=/usr/local/php71/lib/php --mandir=/usr/local/php71/php/man --with-config-file-path=/usr/local/php71/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
When running /usr/local/php71/sbin/php-fpm, the error is reported as follows:
Cause: The php-fpm.conf file does not exist
Solution:
Modify the www.conf file, modify the port number that php-fpm monitors to 9001
Start php-fpm, the results are as follows, it is successful, the system runs two versions of php
Finally, you can add the new version of php to start automatically at boot, modify /etc/rc.local file, just add the running path of php-fpm
The above is the detailed content of How to install multiple php versions in linux. For more information, please follow other related articles on the PHP Chinese website!