前回の続きです。
とりあえずは、これで Apache + PHP + MySQL、いわゆる LAMPサーバが立ち上がったのですが、Joomla! が PDO_MySQL で動くかのテストのために、一度 Joomla! をインストールしてみましたら、別の問題が発生しました。
それがこちら、Mcrypt Supportが「いいえ」になっています。

これは、Plamo5.2 で phpMyAdmin のインストール時に経験していますので楽勝と思って始めましたところ、いくつか引っかかり、ちょっとばかり苦労しました。
Plamo-5.2/phpMyAdminインストール(完了) – @半径とことこ60分
以下、その経緯です。
01libmcrypt のインストール
/usr/local/src/とかに移動して、
# wget https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz # tar -zxvf libmcrypt-2.5.8.tar.gz # cd libmcrypt-2.5.8 # ./configure --prefix=/usr --disable-posix-threads --enable-dynamic-loading # make # make install
これで、/usr/lib/以下に libmcrypt がインストールされます。
全てを管理者で実行していますが、makeまではユーザ領域でやりsudoでインストールした方がいいかもしません。それぞれの判断で。
02PHP をソースから再インストール
同じく、/usr/local/src/とかで、phpinfo で取り出した configureオプションに--with-mcrypt=/usr/libを追加してコンパイルします。
# wget http://jp2.php.net/distributions/php-5.6.25.tar.gz
# tar -zxvf php-5.6.25.tar.gz
# cd php-5.6.25
# ./configure \
--prefix=/usr \
--libdir=/usr/lib64 \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=${prefix}/share/man \
--with-apxs2=/usr/bin/apxs \
--with-zlib \
--with-curl \
--with-gd \
--enable-gd-jis-conv \
--with-freetype-dir=/usr \
--with-jpeg-dir=/usr \
--enable-mbstring \
--enable-pdo \
--with-pdo-mysql=shared,/opt/mysql \
--with-pdo-sqlite \
--with-config-file-path=/etc/httpd/ \
--enable-zip=shared \
--with-libzip \
--enable-ftp=shared \
--with-bz2=shared \
--with-db4=shared,/usr \
--with-gdbm=shared \
--enable-exif=shared \
--with-ldap=shared \
--with-libdir=lib64 \
--with-mcrypt=/usr/lib
(略)
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
止まってしまいました。ググりましたら、そのものズバリのサイト『PHPをソースからインストールするときにopcacheを有効にできない』がヒットしましたので参考にさせていただき、
# find / -name "*opcache*" /usr/lib64/extensions/no-debug-non-zts-20131226/opcache.so # vi /etc/ld.so.conf (で /usr/lib64 を追加) # ldconfig (再度) # .configure \ --prefix=/usr \ (略) config.status: main/php_config.h is unchanged config.status: executing default commands # (とコンフィグが通りましたので) # make (略) Build complete. Don't forget to run 'make test'. # make test (略) You may have found a problem in PHP. This report can be automatically sent to the PHP QA team at http://qa.php.net/reports and http://news.php.net/php.qa.reports This gives us a better understanding of PHP's behavior. If you don't want to send the report immediately you can choose option "s" to save it. You can then email it to qa-reports@lists.php.net later. Do you want to send this report now? [Yns]: s Please send /usr/local/src/php-5.6.25/php_test_results_20160915_1634.txt to qa-reports@lists.php.net manually, thank you. #
と失敗してしまいました。
ただ、いろいろ読みますと、PHP の make testがエラーなく通ることはほとんどないそうで、保存したphp_test_results_20160915_1634.txtを見てみてもエラーの原因をつかめませんでしたので、一度インストールしてみることにしました。
下のremovepkg phpはインストールされている PHP を削除しています。
# removepkg php # make install (略) # apachectl restart [Thu Sep 15 16:53:21.467227 2016] [so:warn] [pid 20977] AH01574: module php5_module is already loaded, skipping
インストーラが/etc/httpd/httpd.confにphp5_moduleを追加したようですので削除して、再度 Apache をリスタートして、phpinfo を見てみます。

無事、Mcrypt が組み込まれているようです。が、dir が指定されていませんので、php.iniに指定しなくてはいけないのでしょう。
(2016/9/16)マニュアルによりますと、コンパイルの時に指定したディレクトリがデフォルトになっているようですのでこのままで問題ないかもしれません。問題が出たら設定しましょう。
時間がなくなりましたので次回です。