php教程 php手册 linux php编译安装

linux php编译安装

Jun 17, 2016 am 08:21 AM

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

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)