linux php编译安装
1、下载php安装包
http://cn2.php.net/get/php-5.5.36.tar.gz/from/this/mirror
默认情况下Nginx和PHP他俩之间是一点感觉没有的。Apache+PHP编译后生成的是模块文件,而Nginx+PHP需要PHP生成可执行文件才可以,所以要利用fastcgi技术来实现Nginx与PHP的整合,这个只要我们安装时启用 FastCGI即可。此次我们安装PHP不仅使用了FastCGI,而且还使用了PHP-FPM这么一个东东,PHP-FPM说白了是一个管理 FastCGI的一个管理器,它作为PHP的插件存在,在安装PHP时要想使用PHP-FPM就需要把PHP-FPM以补丁的形式安装到PHP中,而且 PHP要与PHP-FPM版本一致,这是必须的,切记!
2、安装
[root@localhost src]# <span style="color: #0000ff;">tar</span> -zxvf php-<span style="color: #800080;">5.5</span>.<span style="color: #800080;">36</span>.<span style="color: #0000ff;">tar</span><span style="color: #000000;">.gz [root@localhost src]# cd php</span>-<span style="color: #800080;">5.5</span>.<span style="color: #800080;">36</span><span style="color: #000000;"> [root@localhost php</span>-<span style="color: #800080;">5.5</span>.<span style="color: #800080;">36</span>]# ./configure --prefix=/usr/local/php --with-config-<span style="color: #0000ff;">file</span>-path=/usr/local/php/etc --with-png-<span style="color: #0000ff;">dir</span>=/usr/local/libpng --with-jpeg-<span style="color: #0000ff;">dir</span>=/usr/local/jpeg --with-freetype-<span style="color: #0000ff;">dir</span>=/usr/local/freetype --with-zlib-<span style="color: #0000ff;">dir</span>=/usr/local/zlib --with-mcrypt=/usr/local/libmcrypt --with-libxml-<span style="color: #0000ff;">dir</span>=/usr/local/libxml2/ --with-iconv-<span style="color: #0000ff;">dir</span>=/usr/local/libiconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring=all --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-<span style="color: #0000ff;">zip</span> --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype --enable-shared --with-<span style="color: #000000;">gd [root@localhost php</span>-<span style="color: #800080;">5.5</span>.<span style="color: #800080;">36</span>]<span style="color: #0000ff;">make</span><span style="color: #000000;"> clean [root@localhost php</span>-<span style="color: #800080;">5.5</span>.<span style="color: #800080;">36</span>]<span style="color: #0000ff;">make</span><span style="color: #000000;"> [root@localhost php</span>-<span style="color: #800080;">5.5</span>.<span style="color: #800080;">36</span>]<span style="color: #0000ff;">make</span> <span style="color: #0000ff;">install</span>
3、将源码中的php.ini-development复制到设置的 php.ini 的搜索路径下
[root@localhost php-<span style="color: #800080;">5.5</span>.<span style="color: #800080;">36</span>]# <span style="color: #0000ff;">cp</span> php.ini-development /usr/local/php/etc/php.ini
4、复制一份php-fpm配置文件,命名为php-fpm.conf(/usr/local/php/etc路径下)
[root@localhost etc]# <span style="color: #0000ff;">cp</span> php-fpm.conf.default php-fpm.conf
5、启动php-fpm
[root@localhost /]# /usr/local/php/sbin/php-<span style="color: #000000;">fpm [root@localhost </span>/]# <span style="color: #0000ff;">ps</span> aux | <span style="color: #0000ff;">grep</span> php-<span style="color: #000000;">fpm root </span><span style="color: #800080;">7790</span> <span style="color: #800080;">0.0</span> <span style="color: #800080;">0.2</span> <span style="color: #800080;">27300</span> <span style="color: #800080;">3048</span> ? Ss <span style="color: #800080;">22</span>:<span style="color: #800080;">23</span> <span style="color: #800080;">0</span>:<span style="color: #800080;">00</span> php-fpm: master process (/usr/local/php/etc/php-<span style="color: #000000;">fpm.conf) nobody </span><span style="color: #800080;">7791</span> <span style="color: #800080;">0.0</span> <span style="color: #800080;">0.4</span> <span style="color: #800080;">27300</span> <span style="color: #800080;">4380</span> ? S <span style="color: #800080;">22</span>:<span style="color: #800080;">23</span> <span style="color: #800080;">0</span>:<span style="color: #800080;">00</span> php-<span style="color: #000000;">fpm: pool www nobody </span><span style="color: #800080;">7792</span> <span style="color: #800080;">0.0</span> <span style="color: #800080;">0.2</span> <span style="color: #800080;">27300</span> <span style="color: #800080;">2524</span> ? S <span style="color: #800080;">22</span>:<span style="color: #800080;">23</span> <span style="color: #800080;">0</span>:<span style="color: #800080;">00</span> php-<span style="color: #000000;">fpm: pool www root </span><span style="color: #800080;">8124</span> <span style="color: #800080;">0.0</span> <span style="color: #800080;">0.0</span> <span style="color: #800080;">4420</span> <span style="color: #800080;">756</span> pts/<span style="color: #800080;">3</span> S+ <span style="color: #800080;">23</span>:<span style="color: #800080;">19</span> <span style="color: #800080;">0</span>:<span style="color: #800080;">00</span> <span style="color: #0000ff;">grep</span> php-fpm
附:
1、查找php配置文件路径
[root@localhost /]# /usr/local/php/bin/php --<span style="color: #000000;">ini Configuration File (php.ini) Path: </span>/usr/local/php/<span style="color: #000000;">etc Loaded Configuration File: </span>/usr/local/php/etc/<span style="color: #000000;">php.ini Scan </span><span style="color: #0000ff;">for</span> additional .ini files <span style="color: #0000ff;">in</span><span style="color: #000000;">: (none) Additional .ini files parsed: (none)</span>
2、关闭php-fpm
[root@localhost /]# <span style="color: #0000ff;">killall</span> php-fpm
3、php核心配置选项列表
http://php.net/manual/zh/configure.about.php

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
