.. index:: php_5.4.31 PHP 5.4.31 ============= .. contents:: Contents =========== 実行環境 =========== :ref:`sl_6.4` =========== 最終検証日 =========== 2014/07/25 =========== 依存関係 =========== * :doc:`../../library/libxml2/index` =========== コンパイル =========== .. note:: 基本的に管理者権限ユーザ(rootなど)で作業されることを前提としています .. code-block:: bash #------------------------------------------------------------ # php 5.4.31 #------------------------------------------------------------ BASE=/opt/brew # ソースダウンロード先 comp_dir=/usr/local/src # パッケージ名 pack_name=php # バージョン version=-5.4.31 # ソースのファイル形式 ext=.tar.gz # 解凍コマンド tar_cmd="tar zxf" # インストール先ディレクトリ ins_dir=/opt/${pack_name}/${version##-} # ダウンロード元パッケージ dl_uri="http://jp1.php.net/get/php-5.4.31.tar.gz/from/this/mirror" cd ${comp_dir} rm -rf ${pack_name}${version} test -f ${pack_name}${version}${ext} \ || wget ${dl_uri} -O ${pack_name}${version}${ext} ${tar_cmd} ${pack_name}${version}${ext} cd ${pack_name}${version} ./configure \ --prefix=${ins_dir} \ --enable-mbstring \ --with-libxml-dir=${BASE} \ && nice -n 15 make -j${proc_num}\ && make install ================ Pathの設定 ================ .. code-block:: bash for type in $(ls -1 ${ins_dir}) do for src in $(find ${ins_dir}/${type} -xtype f) do parent=`dirname ${src#*/${type}/}` filename=`basename ${src}` mkdir -p /opt/brew/$type/$parent echo "ln -fs ${src} ${BASE}/${type}/${parent}/${filename}" ln -fs ${src} ${BASE}/${type}/${parent}/${filename} done done grep -q ${BASE}/bin ~/.bashrc \ || echo "export PATH=${BASE}/bin:${BASE}/sbin:"'${PATH}' >> ~/.bashrc \ ; source ~/.bashrc ======================== 主なconfigureオプション ======================== ``--prefix=[DIR]`` インストール先ディレクトリの指定 ``--with-libxml-dir=[DIR]`` libxml2のインストールディレクトリを指定 DOMやxmlパーサに必要 インストールしない場合かなりの機能を制限されます ``--with-apxs2[=DIR]`` Apache2.x系と連携するためのモジュールをコンパイルします デフォルトは/usr/local/apache ex.) --with-apxs2=/path/to/apxs ``--with-mysql[=DIR]`` MySQLと連携する場合は必須 ``--enable-fpm`` nginxと連携させる場合に必要 ``--with-curl=[DIR]`` cURLを使用する場合に指定が必要 =========== Apache連携 =========== | configureのオプションに ``--with-apxs2[=DIR]`` を付けてコンパイルします。 | 既にhttpd.confにはphpのモジュールを読み込むように設定されていますので、拡張子とPHPの実行を結びつけます。 .. code-block:: text AddHandler application/x-httpd-php .php