Home Backend Development PHP Tutorial 1.8LNMP环境编译安装php-5.6.14

1.8LNMP环境编译安装php-5.6.14

Jun 20, 2016 pm 12:42 PM

一、解压php

[root@www src]# tar jxf php-5.6.14.tar.bz2 

[root@www src]# cd php-5.6.14


二、创建PHP相关用户

[root@www php-5.6.14]# useradd -s /sbin/nologin php-fpm


三、编译安装php

[root@www php-5.6.14]# ./configure \

> --prefix=/usr/local/php \

> --with-config-file-path=/usr/local/php/etc \

> --enable-fpm \

> --with-fpm-user=php-fpm \

> --with-fpm-group=php-fpm \

> --with-mysql=/usr/local/mysql \

> --with-mysql-sock=/var/lib/mysql/mysql.sock \

> --with-mysqli=/usr/local/mysql/bin/mysql_config \

> --with-freetype-dir=/usr/local/freetype \

> --with-jpeg-dir=/usr/local/jpeg6 \

> --with-mcrypt=/usr/local/libmcrypt \

> --with-gd=/usr/local/libgd2 \

> --with-iconv-dir=/usr/local/libiconv \

> --with-png-dir \

> --with-zlib \

> --with-libxml-dir \

> --with-curl \

> --with-mhash \

> --with-openssl \

> --with-pear \

> --enable-soap \

> --enable-gd-native-ttf \

> --enable-ftp \

> --enable-mbstring \

> --enable-exif \

> --enable-zend-multibyte \

> --disable-ipv6 \

> --enable-bcmath \

> --enable-shmop \

> --enable-sysvsem \

> --with-pcre-dir


configure: WARNING: unrecognized options: --enable-zend-multibyte (不支持的参数)


[root@www php-5.6.14]# make && make install

[root@www php-5.6.14]# ls /usr/local/php/

bin  etc  include  lib  php  sbin  var


1、复制php主配置文件

[root@www php-5.6.14]# cp php.ini-production /usr/local/php/etc/php.ini


2、复制启动脚本

[root@www php-5.6.14]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

[root@www php-5.6.14]# chmod 755 /etc/init.d/php-fpm 

[root@www php-5.6.14]# chkconfig --add php-fpm

[root@www php-5.6.14]# chkconfig php-fpm on


3、拷贝php-fpm配置文件

[root@www php-5.6.14]# mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

[root@www php-5.6.14]# ls /usr/local/php/etc/

pear.conf  php-fpm.conf  php.ini


4、检查配置错误

[root@www php-5.6.14]# /usr/local/php/sbin/php-fpm -t

[16-Dec-2015 14:16:26] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful


5、启动php-fpm

[root@www php-5.6.14]# service php-fpm start

Starting php-fpm  done


6、查看进程

[root@www php-5.6.14]# ps aux | grep php-fpm

root      16922  0.0  0.4 129188  4988 ?        Ss   14:17   0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)                                                                    

php-fpm   16923  0.0  0.4 129188  4636 ?        S    14:17   0:00 php-fpm: pool www                                                                                                            

php-fpm   16924  0.0  0.4 129188  4636 ?        S    14:17   0:00 php-fpm: pool www                                                                                                            

root      16927  0.0  0.0 103248   876 pts/0    S+   14:18   0:00 grep php-fpm


7、查看监听端口

[root@www php-5.6.14]# netstat -nltp | grep php-fpm

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      16922/php-fpm       



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

11 Best PHP URL Shortener Scripts (Free and Premium)

Introduction to the Instagram API Introduction to the Instagram API Mar 02, 2025 am 09:32 AM

Introduction to the Instagram API

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Working with Flash Session Data in Laravel

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

Build a React App With a Laravel Back End: Part 2, React

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

12 Best PHP Chat Scripts on CodeCanyon

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

Notifications in Laravel

See all articles