ホームページ 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 を必要とするため、Nginx と PHP を統合するには fastcgi テクノロジを使用する必要があります。これはインストール時にのみ有効にする必要があります。今回はFastCGIを使用するだけでなく、PHP-FPMのようなものを使用してPHPをインストールしました。 端的に言えば、PHP-FPMはPHPのプラグインとして存在します。 PHP をインストールするには、PHP-FPM をパッチの形式で PHP にインストールする必要があります。また、PHP は PHP-FPM のバージョンと一致している必要があります。これは必須です。

2. インストール

1

2

3

4

5

6

[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

の検索パスにコピーします。

1

[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 の下)

1

[root@localhost etc]# <span style="color: #0000ff;">cp</span> php-fpm.conf.default php-fpm.conf

ログイン後にコピー

5. php-fpm を起動します

1

2

3

4

5

6

[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 構成ファイルのパスを見つけます

1

2

3

4

5

[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 を閉じます

1

[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ヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)