とほぼ同じです。
キーテイクアウトビルディングphp
gccまたはその他のコンパイラスイート。
sudo yum install nginx
libc-devは、ヘッダーを含むC標準ライブラリを提供します
make、これはphpが使用するビルド管理ツールです Configure Scriptを生成するためのsudo chkconfig nginx on sudo service nginx start
バイソン(2.4以降)。
GITからソースコードをチェックすることをお勧めします。これは、インストールを最新の状態に保ち、さまざまなバージョンでコードを試す簡単な方法を提供するためです。 PHPのパッチを送信したり、リクエストをプルしたりする場合は、Gitチェックアウトも必要です。
リポジトリをクローンするには、端末で次のコマンドを実行します。デフォルトでは、マスターブランチにいるので、開発バージョンに移動したい場合は、安定したブランチをチェックアウトする必要があります。たとえば、
sudo yum install nginx
個々のビルドステップにアクセスする前に、「デフォルト」PHPビルドのコマンドを実行する必要があります。これは、gitからのビルドにのみ必要です。
sudo chkconfig nginx on sudo service nginx start
./ BuildConfは構成スクリプトを生成します。これには数分かかる場合があります。
sudo yum install gcc libxml2-devel libXpm-devel gmp-devel libicu-devel t1lib-devel aspell-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libvpx-devel libpng-devel freetype-devel readline-devel libtidy-devel libxslt-devel libmcrypt-devel pcre-devel curl-devel mysql-devel ncurses-devel gettext-devel net-snmp-devel libevent-devel libtool-ltdl-devel libc-client-devel postgresql-devel bison gcc make
./configureスクリプトが上記のステップを介して生成されたら、PHPビルドをカスタマイズするために使用できます。 –help:
を使用して、サポートされているすべてのオプションをリストできます
sudo mkdir /opt/source && cd /opt/source git clone git@github.com:php/php-src.git && cd php-src
ここにいくつかの便利な設定があります:
<span> PHP 5.3: git checkout PHP-5.3 </span><span> PHP 5.4: git checkout PHP-5.4 </span><span> PHP 5.6: git checkout PHP-5.6 </span><span> PHP HEAD: git checkout master </span>
準備を終えた後、PHPバージョン5.6をインストールします。以下を実行してください:
最後のスイッチ(–enable-fpm)により、このPHPバージョンはPHP-FPMで動作します。このPHP-FPMバージョンをApacheで使用する場合は、-fith-fpm-user = apacheおよび-with-fpm-group = apacheを使用してください。一方、NGINXを使用してこのPHP-FPMバージョンを使用する場合は、-fith-fm-user = nginxおよび - with-fpm-group = nginx。
sudo ./buildconf
成功したメッセージは、そうであるように端末に印刷する必要があります:
sudo mkdir -p /opt/php-5.6 sudo mkdir -p /opt/php-5.5
さあ、実際のコンピレーションを実行するためにMakeを使用できます:
この操作の主な結果は、有効なSAPIのPHPバイナリ(デフォルトではSAPI/CLI/PHPおよびSAPI/CGI/PHP-CGI)と、モジュール/ディレクトリの共有拡張機能です。
-Prefix構成を使用して、「インストール」を実行して /usr /local(default)またはその他のディレクトリにphpをインストールできます。この場合、 /opt/php-5.6./configure --help
インストールはINIファイルを作成しないことに注意してください。
[...] Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print `checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for `--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or `..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] [...]
正しいディレクトリにphp.iniとphp-fpm.confをコピーします:
PHPバージョンをもう一度確認して確認します。
sudo yum install nginx
open /opt/php-5.6/etc/php-fpm.confを調整し、リッスンラインの設定を調整します。未使用のポートに変更する必要があります(たとえば、9001;ポート9000はFedoraが使用している可能性があります)
sudo chkconfig nginx on sudo service nginx start
sudo yum install gcc libxml2-devel libXpm-devel gmp-devel libicu-devel t1lib-devel aspell-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libvpx-devel libpng-devel freetype-devel readline-devel libtidy-devel libxslt-devel libmcrypt-devel pcre-devel curl-devel mysql-devel ncurses-devel gettext-devel net-snmp-devel libevent-devel libtool-ltdl-devel libc-client-devel postgresql-devel bison gcc make
新しいPHP-FPMのINITスクリプトを作成することをお勧めします。幸いなことに、PHP 5.3はすでにあなたのためにそれを提供しているので、INITスクリプトをディレクトリにコピーして許可を変更します。
sudo mkdir /opt/source && cd /opt/source git clone git@github.com:php/php-src.git && cd php-src
2番目のPHP(5.5.x)
<span> PHP 5.3: git checkout PHP-5.3 </span><span> PHP 5.4: git checkout PHP-5.4 </span><span> PHP 5.6: git checkout PHP-5.6 </span><span> PHP HEAD: git checkout master </span>
PHP Phalcon拡張機能の構築
sudo ./buildconf
PHP拡張機能をインストールする方法はたくさんあります。 phpize build itを使用します。
sudo mkdir -p /opt/php-5.6 sudo mkdir -p /opt/php-5.5
PHPIZEは、PHPビルドに使用される./BuildConfスクリプトと同様の役割を果たします。まず、$ Prefix/LIB/PHP/BUILDからファイルをコピーすることにより、PHPビルドシステムを拡張機能にインポートします。これらのファイルには、acinclude.m4(phpのm4マクロ)、phpize.m4(拡張機能に設定され、メインビルド命令が含まれている)、およびrun-tests.php。
次に、PHPIZEはAutoCONFを呼び出して./Configureファイルを生成します。これは、拡張機能ビルドのカスタマイズに使用できます。 Memcachedのインストールなど、EnableMemcacheを追加する必要があります
覚えておいてください!拡張機能を構築するときは、-PHP-Configのあるオプションを指定する必要があります(PHPのグローバルインストールが1つしかない場合を除く)。それ以外の場合、./configureはPHPバージョンとフラグを正しく決定できません。さらに、PHP-Configスクリプトは、「インストール」コマンドが生成された *.SOファイルを適切な拡張ディレクトリに移動することを保証します。
最初のPHP Phalcon(2.0)の構築
./configure --help
拡張機能がインストールされた後。それをphp.iniファイルに含めることにより、それでもアクティブ化する必要があります。
[...] Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print `checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for `--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or `..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] [...]
を構築します
./configure \ --prefix=/opt/php-5.6 \ --with-pdo-pgsql \ --with-zlib-dir \ --with-freetype-dir \ --enable-mbstring \ --with-libxml-dir=/usr \ --enable-soap \ --enable-calendar \ --with-curl \ --with-mcrypt \ --with-zlib \ --with-gd \ --with-pgsql \ --disable-rpath \ --enable-inline-optimization \ --with-bz2 \ --with-zlib \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-pcntl \ --enable-mbregex \ --with-mhash \ --enable-zip \ --with-pcre-regex \ --with-mysql \ --with-pdo-mysql \ --with-mysqli \ --with-png-dir=/usr \ --enable-gd-native-ttf \ --with-openssl \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --with-libdir=lib64 \ --enable-ftp \ --with-imap \ --with-imap-ssl \ --with-kerberos \ --with-gettext \ --with-gd \ --with-jpeg-dir=/usr/lib/ --enable-fpm
[...] creating libtool appending configuration tag "CXX" to libtool Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php5.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands
の構成
make
sudo make install
Linuxシステムを使用している場合は、ホストファイルを編集できます。
/opt/php-5.6/bin/php --ini Configuration File (php.ini) Path: /opt/php-5.6/lib Loaded Configuration File: (none) Scan for additional .ini files in: (none) Additional .ini files parsed: (none)
テストの場合、test.phpという新しいファイルを作成し、nginxの上記の構成に対応するフォルダーに配置します。各ファイルに、次のコマンドを追加します
のphpinfo()が必要です
1つのサーバーで複数のPHPバージョンの実行に関するよくある質問 ubuntu 18.04でApacheとPHP-FPMを使用して1つのサーバーで複数のPHPバージョンを実行して、Ubuntu 18.04でApacheとPHP-FPMを使用して1つのサーバーで複数のPHPバージョンを実行するにはどうすればよいですか。必要なPHPバージョンとApacheをインストールします。次に、各サイトにPHP-FPMバージョンを使用するようにApacheを構成する必要があります。これを行うには、各サイトのApache構成ファイルを編集し、ProxyPassMatchディレクティブを設定して正しいPHP-FPMプールを使用します。その後、PHPバージョンごとにPHP-FPMプールを作成する必要があります。最後に、ApacheとPHP-FPMを再起動して変更を適用します。sudo yum install nginx
結論
このチュートリアルでは、必要に応じて、それぞれが異なる拡張機能の独自のセットを備えた、それぞれがサーバー上に複数のアクティブに実行されているバージョンを簡単に実行できる方法を学びました。これは、共有ホスティングを行っている場合、または最先端のバージョンで開発および展開できる間に古代のレガシーアプリをサポートする必要がある場合に役立ちます。
以下のコメントにフィードバックを残してください。いつものように、気に入ったらこの記事を共有してください! ApacheとPHP-FPMを使用してFedora 35に複数のPHPバージョンをインストールするには、ApacheとPHP-FPMを使用してFedora 35に複数のPHPバージョンをインストールするには、必要なPHPバージョンをインストールしてインストールする必要があります。アパッチ。次に、各サイトにPHP-FPMバージョンを使用するようにApacheを構成する必要があります。これを行うには、各サイトのApache構成ファイルを編集し、ProxyPassMatchディレクティブを設定して正しいPHP-FPMプールを使用します。その後、PHPバージョンごとにPHP-FPMプールを作成する必要があります。最後に、ApacheとPHP-FPMを再起動して変更を適用します。
特定のPHPバージョン用にPHP-FPMプールを作成するにはどうすればよいですか? /etc/php/7.2/fpm/pool.d/ディレクトリに新しいプール構成ファイルを作成する特定のPHPバージョン。構成ファイルには、リスニングアドレスとポート、ユーザーとグループ、プロセスマネージャーの設定など、PHP-FPMプールの設定を含める必要があります。 1つのサーバー?ApacheおよびPHP-FPMエラーログをチェックして、1つのサーバーで複数のPHPバージョンを実行することで問題をトラブルシューティングできます。エラーログは、Apache構成またはPHP-FPMプールに関する問題に関する情報を提供できます。 PHP -Vコマンドを使用して、現在のPHPバージョンとA2ENMODコマンドを確認して、どのPHPモジュールが有効になっているかを確認することもできます。
以上が1つのサーバーでPHPの複数のバージョンを実行する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。