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

The method of installing php7 + nginx Environment under centos6.6

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

Share

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

This paper gives an example of how to install php7 + nginx environment under centos6.6. Share with you for your reference, the details are as follows:

1. Install the necessary dependent libraries

> yum-y install gd zlib libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libxslt-devel

2. Download the php source code package

Http://php.net/downloads.php

The file name is: php-7.0.4.tar.gz

3. Decompress the source package

> tar-zxvf php-7.0.4.tar.gz

4. Enter the directory and configure

. / configure-- prefix=/data/nmp/php\-- with-curl\-- with-freetype-dir\-- with-gd\-- with-gettext\-- with-iconv-dir\-- with-kerberos\-- with-libdir=lib\-- with-libxml-dir\-- with-mysqli=mysqlnd\-- with-openssl\-- with-pcre-regex\-with-pdo-mysql=mysqlnd\-with-pdo-sqlite\-with-pear\-- with-png-dir\-- with -xmlrpc\-- with-xsl\-- with-zlib\-- enable-mysqlnd\-- enable-fpm\-- enable-bcmath\-- enable-libxml\-- enable-inline-optimization\-- enable-gd-native-ttf\-- enable-mbregex\-- enable-mbstring\-- enable-opcache\-enable-pcntl\-enable-shmop\-- enable-soap\-- enable-sockets\-- enable-sysvsem\-- enable-xml\-- enable-zip\-- enable -pthreads\-enable-maintainer-zts\-enable-fileinfo

5. Make & & make install

> make & & make install

6. Configuration file

> cp php.ini-development / data/nmp/php/lib/php.ini > cp / data/nmp/php/etc/php-fpm.conf.default / data/nmp/php/etc/php-fpm.conf > cp / data/nmp/php/etc/php-fpm.d/www.conf.default / data/nmp/php/etc/php-fpm.d/www.conf > cp-R. / sapi/fpm/php-fpm / data/nmp/php/etc/init.d/php-fpm

(* need to create an init.d directory)

7. Start

> / data/nmp/php/etc/init.d/php-fpm

8. Nginx integrates php

> vi / data/nmp/nginx/conf/nginx.confserver {listen 80; server_name localhost; charset utf-8; # root website directory location / {root / data/wwwroot; index index.html index.htm index.php;} location ~\ .php$ {# website directory root / data/wwwroot; # phpcgi port, default 9000 fastcgi_pass 127.0.0.1 root 9000; fastcgi_index index.php # document_root points to the website directory fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}}

9. Reload nginx

> / data/nmp/nginx/sbin/nginx-s reload

I hope what is described in this article will be helpful to the configuration of your centos environment.

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