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

How to install php7 in linux

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail how to install php7 in linux. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

How does linux install php7?

1. Install the dependency package

Yum install-y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

2. Download the installation package

Cd / usr/local2 wget https://www.php.net/distributions/php-7.1.31.tar.gz

3. Decompression

Tar-zxvf php-7.1.31.tar.gz

4. Check whether the current environment meets the dependencies of the software to be installed

Cd php-7.1.31./configure-prefix=/usr/local/php-with-config-file-path=/usr/local/php-enable-mbstring-enable-ftp-with-gd-with-jpeg-dir=/usr-with-png-dir=/usr-with-mysql=mysqlnd-with-mysqli=mysqlnd-with-pdo-mysql=mysqlnd-without-pear-disable-phar enable-sockets with-freetype-dir=/usr with-zlib with-libxml- Dir=/usr-with-xmlrpc-enable-zip-enable-fpm-enable-xml-enable-sockets-with-gd-with-zlib-with-iconv-enable-zip-with-freetype-dir=/usr/lib/-enable-soap enable-pcntl enable-cli with-curl

5. Compile and install

Makemake install

6. In the previously compiled source package, find php.ini-production, copy it to / usr/local/php, and rename it to php.ini:

Cp php.ini-production / usr/local/php/php.ini

[optional] set so that PHP error messages are printed on the page

Vi / usr/local/php/php.ini

Change Off to On

8. Copy startup script

$cp. / sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm$ chmod + x / etc/init.d/php-fpm

Modify the php-fpm configuration file:

$cd / usr/local/php/etc$ cp php-fpm.conf.default php-fpm.conf$ vi php-fpm.conf

Remove the semicolon before pid = run/php-fpm.pid

$cd php-fpm.d$ cp www.conf.default www.conf$ vi www.conf

Change the user of user and group to the current user (or not, the user and user group nobody will be added by default)

9. Start PHP

$/ etc/init.d/php-fpm start # php-fpm start command $/ etc/init.d/php-fpm stop # php-fpm stop command $/ etc/init.d/php-fpm restart # php-fpm restart command $ps-ef | grep php or ps-A | grep-I php # check whether PHP has been started successfully

10. Boot self-start

Vi / etc/rc.local

Add / etc/init.d/php-fpm start to chmod + x / etc/rc.d/rc.local

This is the end of this article on "how to install php7 in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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