抹茶 + PHP-5.6.40 + nginx + php-fpm

スポンサーリンク
Linux
スポンサーリンク

SNS 抹茶をインストールする。

スポンサーリンク

php-5.6.40インストール

メインのアプリケーションがphp-8.3で運用しているため抹茶専用のために、php-75.6.40を/usr/localディレクトリにインストールする。
php-7.6.33のインストール経験をもとに、インストールする。

解凍して、configureを実行する。

tar xvfz php-5.6.40.tar.gz
php-5.6.40/
php-5.6.40/php.ini-production
php-5.6.40/.gdbinit
php-5.6.40/Makefile.gcov
php-5.6.40/acinclude.m4
php-5.6.40/.editorconfig
          :
php-5.6.40/pear/install-pear-nozlib.phar
php-5.6.40/pear/fetch.php
php-5.6.40/pear/Makefile.frag
php-5.6.40/README.SUBMITTING_PATCH
# 
# cd php-5.6.40/
#
# ./configure \
--build=arm \
--prefix=/usr/local/php-5.6\
--sysconfdir=/usr/local/php-5.6/etc/php \
--with-config-file-path=/usr/local/php-5.6/etc/php \
--with-config-file-scan-dir=/usr/local/php-5.6/etc/php/conf.d \
--with-xmlrpc \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-zlib \
--with-zlib-dir=/usr/lib \
--with-iconv=/usr/local \
--with-curl \
--with-gettext \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--with-bz2 \
--enable-ftp \
--with-mhash \
--with-iconv=/usr/local \
--with-iconv-dir=/usr/local \
--with-readline \
--with-gettext \
--with-openssl=/usr/local/ssl \
--with-openssl-dir=/usr/local/ssl \
--enable-mysqlnd \
--enable-inline-optimization \
--enable-fpm \
--enable-xml \
--enable-gd-jis-conv \
--enable-intl \
--enable-mbstring \
--enable-mbregex \
--enable-json \
--enable-shared \
--enable-cli \
--disable-debug \
--enable-maintainer-zts \
--enable-bcmath \
--enable-calendar \
--enable-dba \
--enable-exif \
--enable-sysvshm \
--enable-sysvsem \
--enable-sysvmsg \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--with-pear \
--enable-opcache=no \
--with-system-ciphers \
OPENSSL_CFLAGS=-I/usr/local/ssl/include \
OPENSSL_LIBS="-L/usr/local/ssl/lib -lssl -lcrypto"

checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... arm-unknown-none
checking host system type... arm-unknown-none
checking target system type... arm-unknown-none
checking for cc... cc
          :
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する(opensslのエラー発生)。

# make
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -D HAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/ext/date/php_date.c -o ext/date/php_date.lo 
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -D HAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib/astro.c -o ext/date/lib/astro.lo 
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -D HAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib/dow.c -o ext/date/lib/dow.lo 
          :
         次から読み込み:  /usr/local/src/php/php-5.6/php-5.6.40/main/php.h:35,
         次から読み込み:  /usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/openssl.c:29:
/usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/openssl.c:5442:36: エラー: invalid use of incomplete typedef ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
 5442 |         data = emalloc(DH_size(pkey->pkey.dh) + 1);
      |                                    ^~
/usr/local/src/php/php-5.6/php-5.6.40/Zend/zend_alloc.h:71:75: 備考: in definition of macro ‘emalloc’
   71 | #define emalloc(size)                                           _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
      |                                                                           ^~~~
/usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/openssl.c:5443:61: エラー: invalid use of incomplete typedef ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
 5443 |         len = DH_compute_key((unsigned char*)data, pub, pkey->pkey.dh);
      |                                                             ^~
make: *** [Makefile:628: ext/openssl/openssl.lo] エラー 1
# 

 

patchを適用する。

以下のURLに対処法が記載されていた。patchを適用する必要が有る。
PHP5.6でOpenssl1.1.0に対応する

リンク先でパッチが表示されるので、ファイルに書き込みパッチを適用する。

一ヵ所パッチが拒否される。ext/openssl/tests/bug66501.phptファイルを直接修正して対応する。
※bug66501.phpt.rejファイル内の「-」行を「+」行の内容に修正する。

# vi ../php-5.6_openssl.patch
#
# patch -p1 < ../php-5.6_openssl.patch
patching file ext/openssl/openssl.c
patching file ext/openssl/tests/bug41033.phpt
patching file ext/openssl/tests/bug66501.phpt
Hunk #1 FAILED at 16 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file ext/openssl/tests/bug66501.phpt.rej
patching file ext/openssl/tests/openssl_error_string_basic.phpt
patching file ext/openssl/tests/sni_server.phpt
patching file ext/openssl/xp_ssl.c
patching file ext/phar/util.c
# 
# cat ext/openssl/tests/bug66501.phpt.rej
--- ext/openssl/tests/bug66501.phpt	2017-07-06 00:25:00.000000000 +0200
+++ ext/openssl/tests/bug66501.phpt	2017-08-01 10:49:25.008823468 +0200
@@ -16,7 +16,7 @@ AwEHoUQDQgAEPq4hbIWHvB51rdWr8ejrjWo4qVNW
 sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
 -----END EC PRIVATE KEY-----';
 $key = openssl_pkey_get_private($pkey);
-$res = openssl_sign($data ='alpha', $sign, $key, 'ecdsa-with-SHA1');
+$res = openssl_sign($data ='alpha', $sign, $key, OPENSSL_VERSION_NUMBER < 0x10100000 ? 'ecdsa-with-SHA1' : 'SHA1');

 var_dump($res);
 --EXPECTF--
 bool(true)
#

 

makeする(ext/intl/intl_convertcpp.loでエラー発生)

ソースファイルの修正だけのため、エラーが発生した場所からmakeを継続させる。

# make
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile cc  -Iext/openssl/ -I/usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/openssl.c -o ext/openssl/openssl.lo 
/usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/openssl.c: 関数 ‘add_assoc_name_entry’ 内:
/usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/openssl.c:797:25: 警告: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations]
  797 |                         to_add = ASN1_STRING_data(str);
      |                         ^~~~~~
次のファイルから読み込み:  /usr/local/ssl/include/openssl/evp.h:13,
         次から読み込み:  /usr/local/src/php/php-5.6/php-5.6.40/ext/openssl/openssl.c:44:
/usr/local/ssl/include/openssl/asn1.h:554:35: 備考: ここで宣言されています
  554 | DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x))
      |                                   ^~~~~~~~~~~~~~~~
/usr/local/ssl/include/openssl/opensslconf.h:115:37: 備考: in definition of macro ‘DECLARE_DEPRECATED’
          :
/usr/local/src/php/php-5.6/php-5.6.40/ext/intl/intl_convertcpp.cpp:74:38: エラー: request for member ‘getBuffer’ in ‘from’, which is of non-class type ‘const int’
   74 |         const UChar *utf16buf = from.getBuffer();
      |                                      ^~~~~~~~~
/usr/local/src/php/php-5.6/php-5.6.40/ext/intl/intl_convertcpp.cpp:76:76: エラー: request for member ‘length’ in ‘from’, which is of non-class type ‘const int’
   76 |         u_strToUTF8WithSub(*res, capacity - 1, &actual_len, utf16buf, from.length(),
      |                                                                            ^~~~~~
make: *** [Makefile:940: ext/intl/intl_convertcpp.lo] エラー 1
#

 

configureする。

環境変数を指定するためmake cleanを実行して、再度configureコマンドを実行する。

# make clean
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp5.la sapi/cli/php sapi/cgi/php-cgi   sapi/fpm/php-fpm  modules/* libs/*
#
# export CC="gcc -DTRUE=1 -DFALSE=0"
#
# export CXX="g++ -DTRUE=1 -DFALSE=0"
#
# export CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1'
#
# CXXFLAGS="-std=c++11" \
./configure \
--build=arm \
--prefix=/usr/local/php-5.6 \
--sysconfdir=/usr/local/php-5.6/etc/php \
--with-config-file-path=/usr/local/php-5.6/etc/php \
--with-config-file-scan-dir=/usr/local/php-5.6/etc/php/conf.d \
--with-xmlrpc \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/lib/mysql/mysql.sock \
--with-zlib \
--with-zlib-dir=/usr/lib \
--with-iconv=/usr/local \
--with-curl \
--with-gettext \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--with-bz2 \
--enable-ftp \
--with-mhash \
--with-iconv=/usr/local \
--with-iconv-dir=/usr/local \
--with-readline \
--with-gettext \
--with-openssl=/usr/local/ssl \
--with-openssl-dir=/usr/local/ssl \
--enable-mysqlnd \
--enable-inline-optimization \
--enable-fpm \
--enable-xml \
--enable-gd-jis-conv \
--enable-intl \
--enable-mbstring \
--enable-mbregex \
--enable-json \
--enable-shared \
--enable-cli \
--disable-debug \
--enable-maintainer-zts \
--enable-bcmath \
--enable-calendar \
--enable-dba \
--enable-exif \
--enable-sysvshm \
--enable-sysvsem \
--enable-sysvmsg \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--with-pear \
--enable-opcache=no \
--with-system-ciphers \
OPENSSL_CFLAGS=-I/usr/local/ssl/include \
OPENSSL_LIBS="-L/usr/local/ssl/lib -lssl -lcrypto"

checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... arm-unknown-none
checking host system type... arm-unknown-none
checking target system type... arm-unknown-none
checking for cc... cc
          :
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: main/php_config.h is unchanged
config.status: executing default commands
# 

 

makeする(Zend/zend_operators.loでエラー発生)。

 

# make
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -D HAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/ext/date/php_date.c -o ext/date/php_date.lo 
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -D HAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib/astro.c -o ext/date/lib/astro.lo
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/date/lib -D HAVE_TIMELIB_CONFIG_H=1 -Iext/date/ -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend    -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib/dow.c -o ext/date/lib/dow.lo 
          :
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile gcc -DTRUE=1 -DFALSE=0  -IZend/ -I/usr/local/src/php/php-5.6/php-5.6.40/Zend/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend  -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1  -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/Zend/zend_operators.c -o Zend/zend_operators.lo 
/tmp/ccTNYGkg.s: Assembler messages:
/tmp/ccTNYGkg.s:7000: Error: operand 2 must be an integer register -- mul x2,v0,v1'
/tmp/ccTNYGkg.s:7001: Error: operand 2 must be an integer register -- smulh x0,v0,v1'
/tmp/ccTNYGkg.s:7715: Error: operand 2 must be an integer register -- mul x2,v9,v0'
/tmp/ccTNYGkg.s:7716: Error: operand 2 must be an integer register -- smulh x1,v9,v0'
/tmp/ccTNYGkg.s:7863: Error: operand 2 must be an integer register -- mul x2,v0,v0'
/tmp/ccTNYGkg.s:7864: Error: operand 2 must be an integer register -- smulh x1,v0,v0'
make: *** [Makefile:1792: Zend/zend_operators.lo] エラー 1
# 

 

ソースファイルを修正する。

修正に関するWEBサイトを失念したが、arm64 CPUに関しては修正が必要である。

# cp Zend/zend_multiply.h  Zend/zend_multiply.h_org
#
# vi Zend/zend_multiply.h
#
# diff -c Zend/zend_multiply.h_org Zend/zend_multiply.h
*** Zend/zend_multiply.h_org    2025-06-15 16:56:03.485673932 +0900
--- Zend/zend_multiply.h        2025-06-15 17:12:26.798994491 +0900
***************
*** 63,69 ****
                "smulh %1, %2, %3\n"                                                                            \
                "sub %1, %1, %0, asr #63\n"                                                                     \
                        : "=X"(__tmpvar), "=X"(usedval)                                                 \
!                       : "X"(a), "X"(b));                                                                              \
        if (usedval) (dval) = (double) (a) * (double) (b);                              \
        else (lval) = __tmpvar;                                                                                 \
  } while (0)
--- 63,69 ----
                "smulh %1, %2, %3\n"                                                                            \
                "sub %1, %1, %0, asr #63\n"                                                                     \
                        : "=X"(__tmpvar), "=X"(usedval)                                                 \
!                       : "r"(a), "r"(b));                                                                              \
        if (usedval) (dval) = (double) (a) * (double) (b);                              \
        else (lval) = __tmpvar;                                                                                 \
  } while (0)
#

 

makeする(正常終了)。

ソースファイルの修正だけのため、エラーが発生した場所からmakeを継続させる。

# make
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile gcc -DTRUE=1 -DFALSE=0  -IZend/ -I/usr/local/src/php/php-5.6/php-5.6.40/Zend/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend  -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1  -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/Zend/zend_operators.c -o Zend/zend_operators.lo
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile gcc -DTRUE=1 -DFALSE=0  -IZend/ -I/usr/local/src/php/php-5.6/php-5.6.40/Zend/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend  -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1  -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/Zend/zend_ptr_stack.c -o Zend/zend_ptr_stack.lo
/bin/sh /usr/local/src/php/php-5.6/php-5.6.40/libtool --silent --preserve-dup-deps --mode=compile gcc -DTRUE=1 -DFALSE=0  -IZend/ -I/usr/local/src/php/php-5.6/php-5.6.40/Zend/ -DPHP_ATOM_INC -I/usr/local/src/php/php-5.6/php-5.6.40/include -I/usr/local/src/php/php-5.6/php-5.6.40/main -I/usr/local/src/php/php-5.6/php-5.6.40 -I/usr/local/src/php/php-5.6/php-5.6.40/ext/date/lib -I/usr/local/src/php/php-5.6/php-5.6.40/ext/ereg/regex -I/usr/include/libxml2 -I/usr/local/ssl/include -I/usr/local/include -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/oniguruma -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/mbstring/libmbfl/mbfl -I/usr/local/src/php/php-5.6/php-5.6.40/ext/sqlite3/libsqlite -I/usr/local/src/php/php-5.6/php-5.6.40/TSRM -I/usr/local/src/php/php-5.6/php-5.6.40/Zend  -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1 -DU_USING_ICU_NAMESPACE=1  -I/usr/local/include -g -O2 -fvisibility=hidden -DZTS  -c /usr/local/src/php/php-5.6/php-5.6.40/Zend/zend_stack.c -o Zend/zend_stack.lo
          :
/usr/bin/ld: warning: libcrypto.so.3, needed by /usr/lib64/libcurl.so, may conflict with libcrypto.so.1.1
/usr/bin/ld: warning: libcrypto.so.3, needed by /usr/lib64/libcurl.so, may conflict with libcrypto.so.1.1
/usr/bin/ld: warning: libcrypto.so.3, needed by /usr/lib64/libcurl.so, may conflict with libcrypto.so.1.1
Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
directorygraphiterator.inc
directorytreeiterator.inc
clicommand.inc
invertedregexiterator.inc
pharcommand.inc
phar.inc

Build complete.
Don't forget to run 'make test'.

#

 

気休めでtestする。

すべたがPASSになるのは難しいので、テストして見ました、的なテストです。

# make test

Build complete.
Don't forget to run 'make test'.

=====================================================================
PHP         : /usr/local/src/php/php-5.6/php-5.6.40/sapi/cli/php 
PHP_SAPI    : cli
PHP_VERSION : 5.6.40
ZEND_VERSION: 2.6.0
PHP_OS      : Linux - Linux raspberrypi 6.1.31-v8.1.el9.altarch #1 SMP PREEMPT Sat Jun 10 22:16:20 UTC 2023 aarch64
INI actual  : /usr/local/src/php/php-5.6/php-5.6.40/tmp-php.ini
More .INIs  :  
CWD         : /usr/local/src/php/php-5.6/php-5.6.40
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2025-06-15 08:38:42
=====================================================================
TEST 1/12329 [tests/run-test/test001.phpt]PASS EXPECT [tests/run-test/test001.phpt] 
TEST 2/12329 [tests/run-test/test002.phpt]PASS EXPECTF [tests/run-test/test002.phpt] 
TEST 3/12329 [tests/run-test/test003.phpt]PASS EXPECTREGEX [tests/run-test/test003.phpt] 
TEST 4/12329 [tests/run-test/test004.phpt]PASS INI section allows '=' [tests/run-test/test004.phpt] 
           :
FPM: Test fastcgi_finish_request function [sapi/fpm/tests/017.phpt]
FPM: Test global prefix [sapi/fpm/tests/019.phpt]
FPM: Test pool prefix [sapi/fpm/tests/020.phpt]
FPM: HTTP_PROXY - CVE-2016-5385 [sapi/fpm/tests/022-cve-2016-5385.phpt]
=====================================================================

=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
zend multibyte (2) [ext/mbstring/tests/zend_multibyte-02.phpt] (warn: XFAIL section but test passes)
zend multibyte (6) [ext/mbstring/tests/zend_multibyte-06.phpt] (warn: XFAIL section but test passes)
zend multibyte (8) [ext/mbstring/tests/zend_multibyte-08.phpt] (warn: XFAIL section but test passes)
zend multibyte (10) [ext/mbstring/tests/zend_multibyte-10.phpt] (warn: XFAIL section but test passes)
zend multibyte (11) [ext/mbstring/tests/zend_multibyte-11.phpt] (warn: XFAIL section but test passes)
Phar: bug #69958: Segfault in Phar::convertToData on invalid file [ext/phar/tests/bug69958.phpt] (warn: XFAIL section but test passes)
Bug #69111 Crash in SessionHandler::read() [ext/session/tests/bug69111.phpt] (warn: XFAIL section but test passes)
Bug #70172 - Use After Free Vulnerability in unserialize() [ext/standard/tests/serialize/bug70172.phpt] (warn: XFAIL section but test passes)
=====================================================================

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at

301 Moved Permanently
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]: Please enter your email address. (Your address will be mangled so that it will not go out on any mailinglist in plain text): Posting to http://qa.php.net/buildtest-process.php Thank you for helping to make PHP better. #

 

インストールする。

/usr/local/php-5.6ディレクトリ配下にインストールする。

# make install
Installing PHP CLI binary:        /usr/local/php-5.6/bin/
Installing PHP CLI man page:      /usr/local/php-5.6/php/man/man1/
Installing PHP FPM binary:        /usr/local/php-5.6/sbin/
Installing PHP FPM config:        /usr/local/php-5.6/etc/php/
Installing PHP FPM man page:      /usr/local/php-5.6/php/man/man8/
Installing PHP FPM status page:   /usr/local/php-5.6/php/php/fpm/
Installing PHP CGI binary:        /usr/local/php-5.6/bin/
Installing PHP CGI man page:      /usr/local/php-5.6/php/man/man1/
Installing build environment:     /usr/local/php-5.6/lib/php/build/
Installing header files:           /usr/local/php-5.6/include/php/
Installing helper programs:       /usr/local/php-5.6/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php-5.6/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php-5.6/lib/php/
[PEAR] Archive_Tar    - already installed: 1.4.4
[PEAR] Console_Getopt - already installed: 1.4.1
[PEAR] Structures_Graph- already installed: 1.1.1
[PEAR] XML_Util       - already installed: 1.4.3
[PEAR] PEAR           - already installed: 1.10.7
Wrote PEAR system config file at: /usr/local/php-5.6/etc/php/pear.conf
You may want to add: /usr/local/php-5.6/lib/php to your php.ini include_path
/usr/local/src/php/php-5.6/php-5.6.40/build/shtool install -c ext/phar/phar.phar /usr/local/php-5.6/bin
ln -s -f phar.phar /usr/local/php-5.6/bin/phar
Installing PDO headers:           /usr/local/php-5.6/include/php/ext/pdo/
#

 

php-fpmのコンフィグファイルであるwww.confを設定する。

userとgroupの定義ではなく、php-fpmの受け口となるlisten.owner とlisten.groupの定義を有効化する。

# cd /usr/local/php-5.6/etc/php
#
# cp php-fpm.conf.default php-fpm.conf
#
# vi php-fpm.conf
#
# diff -c php-fpm.conf.default php-fpm.conf
*** php-fpm.conf.default        2025-06-15 20:37:00.409739726 +0900
--- php-fpm.conf        2025-06-14 09:36:04.680649715 +0900
***************
*** 146,153 ****
  ; Unix user/group of processes
  ; Note: The user is mandatory. If the group is not set, the default user's group
  ;       will be used.
! user = nginx
! group = nginx

  ; The address on which to accept FastCGI requests.
  ; Valid syntaxes are:
--- 146,153 ----
  ; Unix user/group of processes
  ; Note: The user is mandatory. If the group is not set, the default user's group
  ;       will be used.
! ;user = nginx
! ;group = nginx

  ; The address on which to accept FastCGI requests.
  ; Valid syntaxes are:
***************
*** 161,167 ****
  ;                            (IPv6 and IPv4-mapped) on a specific port;
  ;   '/path/to/unix/socket' - to listen on a unix socket.
  ; Note: This value is mandatory.
! listen = 127.0.0.1:9000

  ; Set listen(2) backlog.
  ; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
--- 161,168 ----
  ;                            (IPv6 and IPv4-mapped) on a specific port;
  ;   '/path/to/unix/socket' - to listen on a unix socket.
  ; Note: This value is mandatory.
! ;listen = 127.0.0.1:9000
! listen = /usr/local/php-5.6/var/run/php-fpm/php-fpm-5.6.sock

  ; Set listen(2) backlog.
  ; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
***************
*** 172,180 ****
  ; BSD-derived systems allow connections regardless of permissions.
  ; Default Values: user and group are set as the running user
  ;                 mode is set to 0660
! ;listen.owner = nginx
! ;listen.group = nginx
! ;listen.mode = 0660
  ; When POSIX Access Control Lists are supported you can set them using
  ; these options, value is a comma separated list of user/group names.
  ; When set, listen.owner and listen.group are ignored
--- 173,181 ----
  ; BSD-derived systems allow connections regardless of permissions.
  ; Default Values: user and group are set as the running user
  ;                 mode is set to 0660
! listen.owner = nginx
! listen.group = nginx
! listen.mode = 0660
  ; When POSIX Access Control Lists are supported you can set them using
  ; these options, value is a comma separated list of user/group names.
  ; When set, listen.owner and listen.group are ignored
***************
*** 187,193 ****
  ; must be separated by a comma. If this value is left blank, connections will be
  ; accepted from any ip address.
  ; Default Value: any
! ;listen.allowed_clients = 127.0.0.1

  ; Specify the nice(2) priority to apply to the pool processes (only if set)
  ; The value can vary from -19 (highest priority) to 20 (lower priority)
--- 188,194 ----
  ; must be separated by a comma. If this value is left blank, connections will be
  ; accepted from any ip address.
  ; Default Value: any
! listen.allowed_clients = 127.0.0.1

  ; Specify the nice(2) priority to apply to the pool processes (only if set)
  ; The value can vary from -19 (highest priority) to 20 (lower priority)

#

 

nginxでアクセスする、および作成するファイルのアクセス権を設定する。

sockファイルとphp-fpmのログファイルの書き込みディレクトリの所有権をnginxユーザに変更する。

# chown -R nginx:nginx /usr/local/php-5.6/var
#

 

php-fpmの自動起動を設定する。

systemdを設定するが正常に起動しないので、簡易的に起動するシェルを作成する。
そして、自動起動を設定し、起動する。

# vi /etc/rc.d/php-fpm-5.6
#
# cat /etc/rc.d/php-fpm-5.6
#!/bin/bash

rm -f /usr/local/php-5.6/var/run/php-fpm/php-fpm-5.6.sock
chown nginx:nginx /usr/local/php-5.6/var/run/php-fpm
sudo -s -u nginx /usr/local/php-5.6/sbin/php-fpm --fpm-config /usr/local/php-5.6/etc/php/php-fpm.conf
#
# chown 755 /etc/rc.d/php-fpm-5.6
#
# cp /etc/rc.local /etc/rc.local_org
#
# diff /etc/rc.local_org /etc/rc.local
23a24,25
>
> /etc/rc.d/php-fpm-5.6
#
# chmod 755 /etc/rc.d/php-fpm-5.6
#
# /etc/rc.d/php-fpm-5.6
#
#  ps -fea | grep nginx
nginx 554 316 0 00:30 ? 00:03:10 php-fpm: pool www
nginx 555 316 0 00:30 ? 00:02:56 php-fpm: pool www
          :
nginx 930010 1 0 20:50 ? 00:00:00 php-fpm: master process (/usr/local/php-5.6/etc/php/php-fpm.conf)
nginx 930011 930010 0 20:50 ? 00:00:00 php-fpm: pool www
nginx 930012 930010 0 20:50 ? 00:00:00 php-fpm: pool www
#

 

MySQLを設定する。

Matchaで利用するデータベースとアクセスするユーザを作成する。
データベース名: matcha
アクセスするユーザ: matcha
パスワード: mypasswrod

# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 116
Server version: 10.5.27-MariaDB MariaDB Server
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> grant all privileges on *.* to matcha@localhost identified by 'mypassword' with grant option;
Query OK, 0 rows affected (0.008 sec)
 
MariaDB [(none)]> create database matcha;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]>
MAriaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.003 sec)

MariaDB [(none)]>
MariaDB [(none)]> commit;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [(none)]>
MariaDB [(none)]> exit
Bye
#

 

抹茶ユーザを作成する。

matchaのプログラムを実行するユーザを作成する。
nginxユーザで動作するパッケージなのユーザ作成は必要ないが、管理のためにユーザを作成する。
matchaユーザが利用するphpがphp-5.6を有効化する。

# adduser matcha
#
# su - matcha
$
$ cp .bashrc .bashrc_org
$
$ vi .bashrc
$
$ diff -c .bashrc_org .bashrc
*** .bashrc_org 2025-06-14 16:40:18.000000000 +0900
--- .bashrc 2025-06-14 16:44:21.000000000 +0900
***************
*** 25,27 ****
--- 25,30 ----
  fi

 unset rc
+
+ PATH="/usr/local/php-5.6/bin:$PATH"
+ export PATH
$
$ source .bashrc
$
$ php -v
PHP 5.6.40 (cli) (built: Jun 15 2025 20:34:45)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
$

 

composerをインストールする。

PHPのパッケージ管理システムであるcomposerをインストールして、matchaユーザが利用できるように以下のディレクトリにコピーする。
  /usr/local/php-5.6/bin

$ cd /home/matcha
$
$ curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...

Composer (version 2.8.9) successfully installed to: /home/matcha/composer.phar
Use it: php composer.phar
$
$ cp composer.phar /usr/local/php-5.6/bin/composer
$
$ composer -V
Composer version 2.2.25 2024-12-11 11:58:02
$

 

CakePHPをインストールする。

/home/matchaユーザのホームディレクトリ配下に、matchaアプリのディレクトリを作成して、CakePHPをインストールする。
appディレクトリにCakePHPのパッケージをインストールする。

$ cd /home/matcha
$
$ mkdir matcha
$
$ cd matcha
$
$ pwd
/home/matcha/matcha
$
$ composer create-project --prefer-dist cakephp/app app
Creating a "cakephp/app" project at "./app"
Installing cakephp/app (3.10.1)
  - Installing cakephp/app (3.10.1): Extracting archive
Created project in /home/matcha/matcha/app
Loading composer repositories with package information
Updating dependencies
Lock file operations: 74 installs, 0 updates, 0 removals
  - Locking ajgl/breakpoint-twig-extension (0.3.5)
  - Locking aptoma/twig-markdown (2.0.0)
  - Locking asm89/twig-cache-extension (1.4.0)
          :
  - Locking wyrihaximus/twig-view (4.4.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 74 installs, 0 updates, 0 removals
cakephp/plugin-installer contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "cakephp/plugin-installer" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y  <---Yを入力
  - Installing cakephp/plugin-installer (1.3.1): Extracting archive
  - Installing aura/intl (3.0.1): Extracting archive
  - Installing symfony/polyfill-ctype (v1.19.0): Extracting archive
          :
- Installing psy/psysh (v0.10.12): Extracting archive
24 package suggestions were added by new dependencies, use composer suggest to see details.
Package laminas/laminas-zendframework-bridge is abandoned, you should avoid using it. No replacement was suggested.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package aptoma/twig-markdown is abandoned, you should avoid using it. No replacement was suggested.
Package asm89/twig-cache-extension is abandoned, you should avoid using it. Use twig/cache-extension instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
> Cake\Composer\Installer\PluginInstaller::postAutoloadDump

     Action required!

     The CakePHP plugin installer v1.3+ no longer requires the
     "post-autoload-dump" hook. Please update your app's composer.json
     file and remove usage of
     Cake\Composer\Installer\PluginInstaller::postAutoloadDump

24 packages you are using are looking for funding.
Use the composer fund command to find out more!
> App\Console\Installer::postInstall
Created config/app_local.php file
Created /home/matcha/matcha/app/tmp/cache/views directory
Set Folder Permissions ? (Default to Y) [Y,n]? Y   <----Yを入力
Permissions set on /home/matcha/matcha/app/tmp/cache
Permissions set on /home/matcha/matcha/app/tmp/cache/models
Permissions set on /home/matcha/matcha/app/tmp/cache/persistent
Permissions set on /home/matcha/matcha/app/tmp/cache/views
Permissions set on /home/matcha/matcha/app/tmp/sessions
Permissions set on /home/matcha/matcha/app/tmp/tests
Permissions set on /home/matcha/matcha/app/tmp
Permissions set on /home/matcha/matcha/app/logs
Updated Security.salt value in config/app_local.php
$

 

nginxへのアクセスを設定する。

CakePHPのホームページ表示用の設定を行う。

# cd /etc/nginx/conf.d
#
# vi matcha.conf
#
# cat matcha.conf
server {
        listen          443 ssl http2;
        server_name     test.testtest.jp;
        root            /home/matcha/matca/app/webroot;
 
        location / {
                index index.php;
                
                location ~\.php$ {
                        try_files       $uri =404;
                        fastcgi_pass    unix:/usr/local/php-5.6/var/run/php-fpm/php-fpm-5.6.sock;
                        include         fastcgi_params;
                        fastcgi_param   SCRIPT_FILENAME $request_filename;
                        fastcgi_param   PATH_INFO       $fastcgi_path_info;
                }
        }
}
#

 

CakePHPの確認

CakePHPのホームページが表示された。
ただし、左下のDatabase項目にアクセスできないメッセージが表示されている。

 

データベースのアクセス設定

app.phpとapp_local.phpを修正する。
CakePHPのホームページで利用しているのはapp_local.phpであるが、2つのファイルを修正する。

$ cd app/conifg
$
$ cp app.php app.php_org
$
$ vi app.php
$
$ diff -c app.php_org app.php
*** app.php_org 2025-06-28 08:10:58.605441921 +0900
--- app.php     2025-06-28 08:12:59.853170261 +0900
***************
*** 273,281 ****
              /*
               * It is recommended to set these options through your environment or app_local.php
               */
!             //'username' => 'my_app',
!             //'password' => 'secret',
!             //'database' => 'my_app',
              /*
               * You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
               */
--- 273,281 ----
              /*
               * It is recommended to set these options through your environment or app_local.php
               */
!             'username' => 'matcha',
!             'password' => 'mypassword',
!             'database' => 'matcha',
              /*
               * You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
               */
$
$ cp app_local.php app_local.php_org
$
$ vi app_local.php
$
$ diff -c app_local.php_org app_local.php
*** app_local.php_org 2025-06-28 08:45:53.332701290 +0900
--- app_local.php 2025-06-28 08:46:33.436610736 +0900
***************
*** 43,51 ****
               * the following line and set the port accordingly
               */
              //'port' => 'non_standard_port_number',
!             'username' => 'my_app',
!             'password' => 'secret',
!             'database' => 'my_app',
              'log' => true,
              'url' => env('DATABASE_URL', null),
           ],
--- 43,51 ----
                  * the following line and set the port accordingly
                  */
                 //'port' => 'non_standard_port_number',
!                'username' => 'matcha',
!                'password' => 'mypassword',
!                'database' => 'matcha',
                 'log' => true,
                 'url' => env('DATABASE_URL', null),
             ],
$

 

php.iniファイルにMySQLのソケット記述を追加する。

phpがMySQLにアクセスするためのソケット記述を追加する。

$ exit
ログアウト
#
# cp /usr/local/php-5.6/etc/php/php.ini /usr/local/php-5.6/etc/php/php.ini_org
#
# vi /usr/local/php-5.6/etc/php/php.ini
#
# diff -c /usr/local/php-5.6/etc/php/php.ini_org /usr/local/php-5.6/etc/php/php.ini
*** /usr/local/php-5.6/etc/php/php.ini_org      2025-06-28 08:28:54.119008377 +0900
--- /usr/local/php-5.6/etc/php/php.ini  2025-06-28 08:29:40.954901826 +0900
***************
*** 1,4 ****
--- 1,5 ----
  memory_limit = 256M
+ pdo_mysql.default_socket=/var/lib/mysql/mysql.sock

  [Date]
  ; Defines the default timezone used by the date functions
#
  

 

php-fpmプロセスを再起動する。

php.iniファイルの変更を有効化させるためにphp-fpmプロセスを再起動する。

ps -fea | grep nginx
nginx       1859       1  0 00:35 ?        00:00:00 /usr/sbin/fcgiwrap -f -c 1
nginx       1868       1  0 00:35 ?        00:00:01 /usr/lib/systemd/systemd --user
nginx       1870    1868  0 00:35 ?        00:00:00 (sd-pam)
nginx       1885       1  0 00:35 ?        00:00:02 php-fpm: master process (/usr/local/php-5.6/etc/php/php-fpm.conf)
nginx       1886    1885  0 00:35 ?        00:00:00 php-fpm: pool www
nginx       1887    1885  0 00:35 ?        00:00:00 php-fpm: pool www
root      152531       1  0 07:38 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx     152532  152531  0 07:38 ?        00:00:00 nginx: worker process
nginx     152533  152531  0 07:38 ?        00:00:05 nginx: worker process
#
# kill -9 1885
#
# /etc/rc.d/php-fpm-5.6
#
# ps -fea | grep nginx
nginx       1859       1  0 00:35 ?        00:00:00 /usr/sbin/fcgiwrap -f -c 1
nginx       1868       1  0 00:35 ?        00:00:01 /usr/lib/systemd/systemd --user
nginx       1870    1868  0 00:35 ?        00:00:00 (sd-pam)
nginx       1886       1  0 00:35 ?        00:00:00 php-fpm: pool www
nginx       1887       1  0 00:35 ?        00:00:00 php-fpm: pool www
root      152531       1  0 07:38 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx     152532  152531  0 07:38 ?        00:00:00 nginx: worker process
nginx     152533  152531  0 07:38 ?        00:00:05 nginx: worker process
nginx     159090       1  0 08:34 ?        00:00:00 php-fpm: master process (/usr/local/php-5.6/etc/php/php-fpm.conf)
#

 

CakePHPの確認

Databaseのアクセスが有効化した。

 

抹茶をインストールする。

 

抹茶アプリをダウンロードする。

以下のURLからダウンロードする。
抹茶SNS

 

アプリを展開する。

ダウンロードした抹茶アプリをmatchaユーザのホームディレクトリにコピーして展開する。

$ cd /home/matcha
$
$ ls -l
合計 5172
drwx------ 5 matcha matcha    4096  1月  4  2024 Maildir
-rwxr-xr-x 1 matcha matcha 2426621  6月 21 16:05 composer.phar
drwxr-xr-x 8 matcha matcha    4096 6月 22 10:47 matcha
-rwxr--r-- 1 matcha matcha 2862992  4月 12 09:34 matcha-sns-1.3.9.zip
$
$ unzip matcha-sns-1.3.9.zip
Archive:  matcha-sns-1.3.9.zip
  inflating: matcha-sns-1.3.9/.gitignore
  inflating: matcha-sns-1.3.9/.htaccess
  inflating: matcha-sns-1.3.9/.travis.yml
  inflating: matcha-sns-1.3.9/app/.htaccess
  inflating: matcha-sns-1.3.9/app/app_controller.php
  inflating: matcha-sns-1.3.9/app/app_model.php
          :
  inflating: matcha-sns-1.3.9/NOTICE
 extracting: matcha-sns-1.3.9/plugins/empty
  inflating: matcha-sns-1.3.9/README
 extracting: matcha-sns-1.3.9/vendors/shells/tasks/empty
 extracting: matcha-sns-1.3.9/vendors/shells/templates/empty
$
$ cd matcha-sns-1.3.9/
$
$ cp -p LICENSE ../matcha/
$ cp -p NOTICE ../matcha/
$ cp -p README ../matcha/
$ cp -r -p app ../matcha/
$ cp -r -p cake ../matcha/
$ cp -r -p vendors ../matcha/
$ cp -p .htaccess ../matcha/
$

 

環境設定を行う。

php.iniを作成してtimezoneやメモリなどを設定する。
設定後は、php-fpmプログラムの再起動が必要です。

# cd /usr/local/php-5.6/etc/php
#
# vi php.ini
#
# cat php.ini
memory_limit = 256M

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Tokyo"
#

抹茶アプリの環境設定を行う。

$ cd /home/matcha/matcha
$
$ cp app/config/core.php app/config/core.php_org
$ vi app/config/core.php
$
$ diff app/config/core.php_org app/config/core.php
206c206
<       Configure::write('Security.salt', 'DYhG93b0qyIfIxfs2guVoUubWwvniR2G0FgaC9mi');
---
>       Configure::write('Security.salt', 'abcdefghijk');
210c210
<       Configure::write('Security.cipherSeed', '76859309657198048034862324894');
---
>       Configure::write('Security.cipherSeed', '11223344556677899');
$

 

nginxユーザにアクセス権を与える。

nginxユーザでアクセスするため、拡張ACLでnginxユーザからのアクセス権を有効化する。

$ exit
ログアウト
#
# chmod 755 /home/matcha
#
# cd /home/matcha/matcha/
#
# ls -l
合計 48
-rw-r--r--  1 matcha matcha 18025  6月 11  2018 LICENSE
-rw-r--r--  1 matcha matcha   821  6月 11  2018 NOTICE
-rw-r--r--  1 matcha matcha  1055  6月 11  2018 README
drwxr-xr-x 14 matcha matcha  4096  6月 21 16:21 app
drwxr-xr-x  6 matcha matcha  4096  6月 21 16:21 cake
-rw-r--r--  1 matcha matcha  1848  6月 11  2018 index.php
drwxr-xr-x  3 matcha matcha  4096  6月 21 16:21 vendors
#
#  setfacl -R -m u:nginx:rwx app
#
# ls -l
合計 48
-rw-r--r--   1 matcha matcha 18025  6月 11  2018 LICENSE
-rw-r--r--   1 matcha matcha   821  6月 11  2018 NOTICE
-rw-r--r--   1 matcha matcha  1055  6月 11  2018 README
drwxrwxr-x+ 14 matcha matcha  4096  6月 21 16:21 app
drwxr-xr-x   6 matcha matcha  4096  6月 21 16:21 cake
-rw-r--r--   1 matcha matcha  1848  6月 11  2018 index.php
drwxr-xr-x   3 matcha matcha  4096  6月 21 16:21 vendors
#
# getfacl app
# file: app
# owner: matcha
# group: matcha
user::rwx
user:nginx:rwx
group::r-x
mask::rwx
other::r-x
#

 

nginxへのアクセスを設定する。

apache用の.htaccessファイルの解析ができていないので暫定設定です。

# cd /etc/nginx/conf.d
#
# vi matcha.conf
#
# cat matcha.conf
server {
        listen          443 ssl http2;
        server_name     ksm.wjg.jp;
        root            /home/matcha/matca;
 
        location / {
                index   index.php;

                rewrite ^/(.*)$ /app/webroot/$1 break;

                location /app/ {
                        rewrite ^/app/(.*)$ /app/webroot/$1 break;
                ]

                location /app/webroot/ {
                        rewrite ^/app/webroot/(.*)$ /app/webroot/$1 break;
                }
 
                location ~\.php$ {
                        try_files       $uri =404;
                        fastcgi_pass    unix:/usr/local/php-5.6/var/run/php-fpm/php-fpm-5.6.sock;
                        include         fastcgi_params;
                        fastcgi_param   SCRIPT_FILENAME $request_filename;
                        fastcgi_param   PATH_INFO       $fastcgi_path_info;
                }
        }
}
#
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
#
# systemctl restart nginx
#

 

抹茶の初期設定

ブラウザでアクセスすると以下の画面が表示される。
問題がなければ左下の「インストール開始」をクリックする。

 

 

 

 

以下は確認中