Home > Article > Backend Development > How to install multiple php in linux
How to install multiple PHP on Linux: first download different PHP source packages, decompress and install them in different directories; then modify the port number monitored by "php-fpm"; then modify the PHP installation configuration parameters; Finally, start "php-fpm".
Recommended: "PHP Video Tutorial"
Installing multiple php versions under the linux system
Download different php source code packages, unzip and install them in different directories, modify the port number that php-fpm listens to
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 and modify the port number that php-fpm monitors to 9001
Start php-fpm, the result is 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 in linux. For more information, please follow other related articles on the PHP Chinese website!