Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Steps to compile and install PHP7.0.2 for Centos7.2

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Environment

System: Centos7.2 Service: Nginx

1: download the PHP7.0.2 installation package to extract, compile, and install:

$cd / usr/src/ $wget http://cn2.php.net/distributions/php-7.0.2.tar.gz $tar-xzxvf php-7.0.2.tar.gz $cd php-7.0.2

1.1 pre-compilation check

Please check if gcc is installed, and execute yum install gcc if not

Check if libxml2 is installed, and execute yum install libxml2 if not

Check if libxml2-devel is installed, and execute yum install libxml2-devel if not

Note: because nginx is used instead, the with-apxs2=/usr/bin/apxs in the compilation parameters is removed. If you want to configure apache, install apache before installing PHP. *

2: compile parameter configuration

The copy code is as follows:

'. / configure''-- prefix=/usr/local/php''--with-pdo-pgsql''--with-zlib-dir''--with-freetype-dir''--enable-mbstring''--with-libxml-dir=/usr''--enable-soap''--enable-calendar''--with-curl''--with-mcrypt''--with-gd''--with-pgsql''--disable -rpath''--enable-inline-optimization''--with-bz2''--with-zlib''--enable-sockets''--enable-sysvsem''--enable-sysvshm''--enable-pcntl''--enable-mbregex''--enable-exif''--enable-bcmath''--with-mhash''--enable-zip''--with-pcre-regex''--with-pdo-mysql '--with-mysqli''-- with-jpeg-dir=/usr''--with-png-dir=/usr''--enable-gd-native-ttf''--with-openssl''--with-fpm-user=www-data''--with-fpm-group=www-data''--with-libdir=/lib/x86_64-linux-gnu/''--enable-ftp''--with-gettext''--with-xmlrpc' '--with-xsl''-- enable-opcache''--enable-fpm''--with-iconv''--with-xpm-dir=/usr'

3: error set

Error Cannot find OpenSSL's execute yum install openssl openssl-devel error Please reinstall the libcurl distribution execute yum-y install curl-devel error jpeglib.h not found execute yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64-y and execute yum install libjpeg-devel error: checking for BZip2 in default path... Not found configure: error: Please reinstall the BZip2 distribution this is the bzip2 package is not installed to execute yum install bzip2-devel.x86_64-y error: configure: error: xpm.h not found. Execute yum install libXpm-devel error: Unable to locate gmp.h execute yum install gmp-devel error: Unable to detect ICU prefix or / usr//bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works execution yum install-y icu libicu libicu-devel error: mcrypt.h not found. Please reinstall libmcrypt. Error executing yum install php-mcrypt libmcrypt libmcrypt-devel: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path execution yum install postgresql-devel error: configure: error: xslt-config not found. Please reinstall the libxslt > = 1.1.0 distribution execute yum install libxslt-devel

4: compile

Make clean & & make & & make install

5:PHP configuration

5.1After installation, we need to copy the configuration file in the source code package to the PHP installation directory. There are two configuration php.ini-development php.ini-production in the source code package. You can tell by the name: one is the development environment and the other is the production environment. We will copy the development environment here.

Cp php.ini-development / usr/local/php/lib/php.ini

5.2 you also need to set environment variables: modify the / etc/profile file to make it permanent and effective for all system users, with the following two lines of code at the end of the file

PATH=$PATH:/usr/local/php/binexport PATH

5.3 then execute the effective command

Source / etc/profile

5.4 View PHP version information

Php-v

6: configure PHP-fpm

Cp / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.confcp / usr/local/php/etc/php-fpm.d/www.conf.default / usr/local/php/etc/php-fpm.d/www.confcp / usr/src/php-7.0.2/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpmchmod + x / etc/init.d/php-fpm

6.1Startup php-fpm:

/ etc/init.d/php-fpm start

6.2 if an error occurs: ERROR: [pool www] cannot get uid for user 'www-data'

Then create a new www-data user group:

Groupadd www-datauseradd-g www-data www-data

6.3 restart php-fpm

/ etc/init.d/php-fpm restart

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report