PHP は PHP ハイパーテキスト プリプロセッサー (PHP Hypertext Preprocessor) です。 主に動的ウェブサイトにおいて利用され、プログラミングコードを HTML マークアップ内に直接埋め込むことができます。 また一般的なスクリプト言語としても利用することができます。
          LFS や依存パッケージが本ブックに示す最新安定バージョンでなかった場合には、BLFS 開発版においては、パッケージのビルドや処理実行が適切に行われないことがあります。
ダウンロード (HTTP): https://www.php.net/distributions/php-8.3.0.tar.xz
ダウンロード MD5 sum: c94426720f6dd2124a25db9fc86c0bfe
ダウンロードサイズ: 12 MB
必要ディスク容量: 525 MB(ドキュメント込み)
概算ビルド時間: 1.6 SBU(parallelism=4 利用時、テスト実施時はさらに 1.7 SBU)
任意の構築済ドキュメント (単一の html ファイル): http://www.php.net/download-docs.php
Optional pre-built documentation (chunked html): https://www.php.net/distributions/manual/php_manual_en.tar.gz. Note that the documentation can be found in languages other than English at https://www.php.net/download-docs.php
Aspell-0.60.8.1, enchant-2.6.4, libxslt-1.1.39, an MTA (that provides a sendmail command), pcre2-10.42, Pth-2.0.7, AppArmor, Dmalloc, Net-SNMP, oniguruma, OSSP mm, re2c, XMLRPC-EPI
FreeType-2.13.2, libexif-0.6.24, libjpeg-turbo-3.0.1, libpng-1.6.40, libtiff-4.6.0, libwebp-1.3.2, グラフィック環境, FDF Toolkit, GD, t1lib
cURL-8.5.0, tidy-html5-5.8.0, Caudium, Hyperwave, Roxen WebServer, and WDDX
libiodbc-3.52.15, lmdb-0.9.31, MariaDB-10.11.6 or MySQL, OpenLDAP-2.6.6, PostgreSQL-16.1, SQLite-3.44.2, unixODBC-2.3.12, Berkeley DB (非推奨) Adabas, Birdstep, cdb, DBMaker, Empress, FrontBase, IBM DB2, Mini SQL, Monetra, and QDBM
PHP also provides support for many commercial database tools such as Oracle, SAP and ODBC Router.
Cyrus SASL-2.1.28, MIT Kerberos V5-1.21.2, libmcrypt, and mhash
PHP は、サーバーサイドのスクリプティング、コマンドラインのスクリプティング、クライアントサイドのGUIアプリケーション、といった場面にて利用することができます。 本書では、ごく普通に利用されている形式である、サーバーサイドのスクリプティングについての手順を説明していくことにします。
          PHP の configure には、各種サポートを実現するためのオプションが数多くあります。 ./configure --help の実行により、利用可能なオプションをすべて確認することができます。 また PHP ウェブサイト を参照することもお勧めします。 このサイトが提供するオンラインドキュメントは、よく仕上がっています。 一般的な依存関係を実現するような configure コマンドの実行例が https://anduin.linuxfromscratch.org/BLFS/files/php_configure.txt に示されているので参照してください。
            何らかの理由により libxml2-2.12.3 をインストールしてない場合は、これ以降に示す
            configure コマンドにて
            --disable-libxml オプションを指定することが必要です。
            これを指定すると pear
            コマンドがビルドされなくなります。
          
以下のコマンドを実行して PHP をビルドします。
./configure --prefix=/usr                \
            --sysconfdir=/etc            \
            --localstatedir=/var         \
            --datadir=/usr/share/php     \
            --mandir=/usr/share/man      \
            --enable-fpm                 \
            --without-pear               \
            --with-fpm-user=apache       \
            --with-fpm-group=apache      \
            --with-fpm-systemd           \
            --with-config-file-path=/etc \
            --with-zlib                  \
            --enable-bcmath              \
            --with-bz2                   \
            --enable-calendar            \
            --enable-dba=shared          \
            --with-gdbm                  \
            --with-gmp                   \
            --enable-ftp                 \
            --with-gettext               \
            --enable-mbstring            \
            --disable-mbregex            \
            --with-readline              &&
make
        To test the results, issue: make test. Several tests (out of over 18000) may fail, in which case you are asked whether you want to send the report to the PHP developers. If you want to automate the test, you may prefix the command with yes "n" | .
          root ユーザーになって以下を実行します。
        
make install                                     &&
install -v -m644 php.ini-production /etc/php.ini &&
install -v -m755 -d /usr/share/doc/php-8.3.0 &&
install -v -m644    CODING_STANDARDS* EXTENSIONS NEWS README* UPGRADING* \
                    /usr/share/doc/php-8.3.0
        
          The default configuration files for the fastCGI process manager are
          installed only if they do not already exist on the system. If this
          is the first installation, they should be renamed, as the
          root user:
        
if [ -f /etc/php-fpm.conf.default ]; then
  mv -v /etc/php-fpm.conf{.default,} &&
  mv -v /etc/php-fpm.d/www.conf{.default,}
fi
        
          構築済の HTML ドキュメントが2つの形式で提供されています。 1つは複数ファイルを収容した1つの tarball です。
          ブラウザー上へは即座に表示できるメリットがあります。 もう1つはただ1つのファイルとして構築されているものです。
          ブラウザー上の検索機能を適切に活用することができます。 ダウンロードした形式がいずれかである場合に、root ユーザーになって以下のコマンドを実行しドキュメントをインストールします。
          (以下の説明ではインストールするドキュメントは英語版であるものとしています。必要に応じて tarball
          名を置き換えて実行してください。)
        
「ただ1つの HTML」である場合は以下を実行します。
install -v -m644 ../php_manual_en.html.gz \
    /usr/share/doc/php-8.3.0 &&
gunzip -v /usr/share/doc/php-8.3.0/php_manual_en.html.gz
        「複数 HTML ファイル」である場合は以下を実行します。
tar -xvf ../php_manual_en.tar.gz \
    -C /usr/share/doc/php-8.3.0 --no-same-owner
        The bundled pear is not installed because of a bug which might pollute the filesystem with several hidden files and directories. If pear is needed, execute the following commands to install it:
wget https://pear.php.net/go-pear.phar php ./go-pear.phar
          --datadir=/usr/share/php:
          This works around a bug in the build machinery, which installs some
          data to a wrong location.
        
          --enable-fpm: This
          parameter allows building the fastCGI Process Manager.
        
          --with-fpm-systemd: This
          parameter allows the FastCGI Process Manager to integrate with
          systemd.
        
          --without-pear: This switch
          disables installation of bundled pear software.
        
          --with-config-file-path=/etc:
          このパラメーターは、PHP が利用する設定ファイル
          php.ini を /etc ディレクトリとすることを指示します。
        
          --with-zlib: このパラメーターは
          Zlib 圧縮へのサポートを追加します。
        
          --enable-bcmath:
          bc スタイルの精度計算を有効にします。
        
          --with-bz2: Bzip2 圧縮へのサポートを追加します。
        
          --enable-calendar:
          このパラメーターはカレンダー変換へのサポートを追加します。
        
          --enable-dba=shared: This
          parameter enables support for database (dbm-style) abstraction
          layer functions.
        
          --enable-ftp: This
          parameter enables FTP functions.
        
          --with-gettext: Enables
          functions that use Gettext text
          translation.
        
          --enable-mbstring: This
          parameter enables multibyte string support.
        
          --with-readline: This
          parameter enables command line Readline support.
        
          --disable-libxml: This option allows
          building PHP without libxml2
          installed.
        
          --with-apxs2: Instead of building the
          fastCGI process manager, it is possible to build an apache module. This has some performance
          penalty for heavy loaded servers, but may be easier to set up. This
          switch is incompatible with the --enable-fpm and --with-fpm-... switches.
        
          --with-mysqli=shared: This option
          includes MySQLi support.
        
          --with-mysql-sock=/run/mysqld/mysqld.sock: Location
          of the MySQL unix socket pointer.
        
          --with-pdo-mysql=shared: This option
          includes PDO: MySQL support.
        
          --with-tidy=shared: This option
          includes tidy library support.
        
            The file used as the default /etc/php.ini configuration file is recommended
            by the PHP development team.
            This file modifies the default behavior of PHP. If no /etc/php.ini is used, all configuration
            settings fall to the defaults. You should review the comments in
            this file and ensure the changes are acceptable in your
            particular environment.
          
            The fastCGI process manager uses the configuration file
            /etc/php-fpm.conf. The default file
            shipped with PHP includes all the /etc/php-fpm.d/*.conf in turn. There is a
            shipped /etc/php-fpm.d/www.conf
            file, that contains the parameters related to the interaction
            with the Apache Web server.
          
You may have noticed the following from the output of the make install command:
You may want to add: /usr/lib/php to your php.ini include_path
          
            If desired, add the entry using the following command as the
            root user:
          
sed -i 's@php/includes"@&\ninclude_path = ".:/usr/lib/php"@' \
    /etc/php.ini
          
            To enable fastCGI support in the Apache web server, two LoadModule directives
            must be added to the httpd.conf
            file. They are commented out, so just issue the following command
            as root user:
          
sed -i -e '/proxy_module/s/^#//'      \
       -e '/proxy_fcgi_module/s/^#//' \
       /etc/httpd/httpd.conf
          
            Those modules accept various ProxyPass directives. One
            possibility is (as the root
            user):
          
echo \ 'ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/$1' >> \ /etc/httpd/httpd.conf
            Additionally, it may be useful to add an entry for index.php to the DirectoryIndex directive of
            the httpd.conf file. Lastly, adding
            a line to set up the .phps
            extension to show highlighted PHP source may be desirable:
          
AddType application/x-httpd-php-source .phps
          
            You'll need to restart the Apache web server after making any
            modifications to the httpd.conf
            file.
          
            To start the php-fpm daemon at boot, install
            the systemd unit from the blfs-systemd-units-20231205 package by
            running the following command as the root user:
          
make install-php-fpm