centos7 install php7.4

download:

wget https://www.php.net/distributions/php-7.4.10.tar.gz

Install dependent software

yum install openssl-devel libxml2-devel bzip2-devel \
libcurl-devel libjpeg-devel libpng-devel freetype-devel \
libmcrypt-devel recode-devel libicu-devel libzip-devel\
libxml2-devel sqlite-devel bzip2-devel libcurl-devel libicu-devel

Install two more rpm packages
  1. yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-6.8.2-1.el7.x86_64.rpm

  2. yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm

ps: If the system is ubuntu, you can install dependencies through the following command

apt -y install libfcgi-dev libfcgi0ldbl libjpeg-turbo8-dev libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libfreetype6-dev libkrb5-dev libpq-dev libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev libonig-dev libcurl4-openssl-dev libssl-dev

 

Compile and install:

./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/etc/cgi  --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --enable-gd --with-iconv --with-zlib --with-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp  --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap  --with-gettext --enable-session --with-curl --with-jpeg --with-freetype --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --without-gdbm --disable-fileinfo

Two problems will occur during configure compilation: 

(1) No package'libzip' found or (libzip >= 0.11)

It prompts No package'libzip' found or (libzip >= 0.11). The reason is that libzip is not installed or the version is too low. The solution is as follows:

#Uninstall the old version of libzipyum remove libzip#Download and install libzip-1.2.0wget https://libzip.org/download/libzip-1.2.0.tar.gztar -zxvf libzip-1.2.0.tar.gzcd libzip-1.2. 0./configuremake && make install

After the installation is complete, check whether the /usr/local/lib/pkgconfig directory exists, if it exists, execute the following command to set PKG_CONFIG_PATH:

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"

(2) collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1

Solve the problem by executing: make ZEND_EXTRA_LIBS='-liconv'

 

 

Finally, execute make && make install to successfully install

Guess you like

Origin blog.csdn.net/mjian178/article/details/112602330