PHPを上げる

WordPressのinstallにはPHP-7.4が必要らしい。
https://seesaawiki.jp/lifewithslackarmzaurus_15_0/d/WordPress

PHP-7.4.11:
先に古いVerが入っていない事を確認した。
$ ll /var/log/packages/*php*
ls: cannot access ‘/var/log/packages/*php*’: No such file or directory
何故か、slackbuilds.orgにphp-x.yがない。https://slackbuilds.org/slackbuilds/14.2/network/
currentを参考にする。
(http://ftp.kddilabs.jp/Linux/distributions/Slackware/slackware-current/source/n/php/php.SlackBuild を参考に、)
(http://ftp.kddilabs.jp/Linux/distributions/Slackware/slackware-14.2/source/n/php/php.SlackBuild を参考に、)
\# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
\# the name of the created package would be, and then exit. This information
\# could be useful to other scripts.
\$ if [ ! -z “${PRINT_PACKAGE_NAME}” ]; then
\ echo “$PKGNAM-$VERSION-$ARCH-$BUILD.txz”
\ exit 0
\fi
(PRINT_PACKAGE_NAMEて何だ。Slack特有らしい。どうやら依存するpkgのnameやverを取ってくる
\ためだけにあるらしい。今回は無効。例、aaa_terminfo.SlackBuild -> ncurses.SlackBuild:
\VERSION=${VERSION:-$(PRINT_PACKAGE_NAME=yes ./ncurses.SlackBuild | cut -f 2 -d -)}
\よく忘れるVERSION:-とはVERSIONに値がsetされていなければsetするという意味)
$ NUMJOBS=${NUMJOBS:-” -j$(expr $(nproc) + 1) “}
(となっているが、-1の間違いではないか? あと、以下でも行けた)
$ NUMJOBS=${NUMJOBS:-” -j$(echo “$(nproc) + 1” | bc) “} ; echo $NUMJOBS
\-j3
\# Look for Kerberos on the machine and in any precompiled c-client.a:
$ ls -l {,/usr}/lib/libkrb*
(無い。kerberosを先に入れた https://seesaawiki.jp/lifewithslackarmzaurus_15_0/d/krb5%a4%f2%c6%fe%a4%ec%a4%eb )
\# Remove the c-client library if it doesn’t contain Kerberos support:
\if ! grep -q krb5_ /usr/local/lib/c-client/lib/c-client.a 2> /dev/null ; then
\ rm -rf /usr/local/lib/c-client
\fi
(/usr/local/lib/c-clientは最初から無い。ls -d /usr/lib/*/ にも無い)
\# we need to compile alpine to get c-client.a for IMAP support:
$ ls -l /usr/local/lib/c-client/lib/c-client.a
ls: cannot access ‘/usr/local/lib/c-client/lib/c-client.a’: No such file or directory
(alpine.SlackBuildを実行する代わりに、alpine.tgzを展開してコピーする。currentではなく
\14.2にもあるのでそっちを使う。と思ったが、alpine kerberos、でググろうとすると、alpine
\ linux kerberos client が補完されたりする。kerberosのヘッダーをincludeしてるのか?
\念のためにmakeするか)
そっちを先にmakeする。
$ ( cd ~/alpine-2.25/imap/c-client
\ sudo strip -g c-client.a
\ sudo mkdir -p /usr/local/lib/c-client/lib
\ sudo cp c-client.a /usr/local/lib/c-client/lib/
\ sudo mkdir -p /usr/local/lib/c-client/include
\ sudo cp *.h /usr/local/lib/c-client/include
\)
\# Set Kerberos build option:
\if /bin/ls /lib/libkrb5.so.? 1> /dev/null 2> /dev/null ; then
\ KRB5_OPTION=”–with-kerberos”
\else
\ unset KRB5_OPTION
\fi
(kerberosは既に入っているのでconfig_optionに –with-kerberos を追加する)
$ tar xf php-7.4.11.tar.xz
$ cd php-7.4.11
\# cleanup:
$ find . -name “*.orig” -delete
\# Sometimes they ship a few of these:
$ find . -name “*.orig” -exec rm {} \;
\# Patch ini files:
$ zcat /mnt/card/slackware-current/slackware/source/n/php/php.ini-development.diff.gz | patch -p1
$ zcat /mnt/card/slackware-current/source/n/php/php.ini-development.diff.gz | patch -p1 –verbose php.ini-production
$ zcat /mnt/card/slackware-current/source/n/php/php-fpm.conf.diff.gz | patch -p1
\# Fix for imap API change:
$ zcat /mnt/card/slackware-current/source/n/php/php.imap.api.diff.gz | patch -p1
\# Install the build folder into /usr/lib$LIBDIRSUFFIX/php/build
\# and adapt phpize accordingly:
$ sed -i “s|build$|php/build|” scripts/Makefile.frag
$ sed -i “s|build\”$|php/build\”|” scripts/phpize.in
\# NOTE: Added -DU_USING_ICU_NAMESPACE=1 to CXXFLAGS, which should be a temporary
\# requirement. See the link below:
\# http://site.icu-project.org/download/61#TOC-Migration-Issues
(ICUについて https://seesaawiki.jp/lifewithslackzaurus/d/%c6%fc%cb%dc%b8%ec%b4%c4%b6%ad )
\# Generic “kitchen sink” configure function, with as many things as possible (and
\# maybe then some 😉 compiled as shared extensions:
$ EXTENSION_DIR=/usr/lib/php/extensions CFLAGS=”-O2 -march=i686 -mtune=i686″ \
\ CXXFLAGS=”-O2 -march=i686 -mtune=i686 -DU_USING_ICU_NAMESPACE=1″ ./configure \
\ –prefix=/usr –libdir=/usr/lib –with-libdir=lib –localstatedir=/var \
\ –sysconfdir=/etc –datarootdir=/usr/share –datadir=/usr/share –infodir=/usr/info \
\ –mandir=/usr/man –with-apxs2=/usr/bin/apxs –enable-fpm –with-fpm-user=apache \
\ –with-fpm-group=apache –enable-maintainer-zts –enable-pcntl –enable-mbregex \
\ –enable-tokenizer=shared –with-config-file-scan-dir=/etc/php.d \
\ –with-config-file-path=/etc –with-layout=PHP –disable-sigchild –with-libxml \
\ –with-xmlrpc=shared –with-expat –enable-simplexml –enable-xmlreader=shared \
\ –enable-dom=shared –enable-filter –disable-debug –with-openssl=shared \
\ –with-kerberos –with-external-pcre –with-zlib=shared,/usr –enable-bcmath=shared \
\ –with-bz2=shared,/usr –enable-calendar=shared –enable-ctype=shared \
\ –with-curl=shared –enable-dba=shared –with-gdbm=/usr –with-db4=/usr \
\ –enable-exif=shared –enable-ftp=shared –enable-gd=shared –with-external-gd \
\ –with-jpeg –with-xpm –with-gettext=shared,/usr –with-gmp=shared,/usr \
\ –with-iconv=shared –with-imap-ssl=/usr –with-imap=/usr/local/lib/c-client \
\ –with-ldap=shared –enable-mbstring=shared –enable-mysqlnd=shared \
\ –with-mysqli=shared,mysqlnd –with-mysql-sock=/var/run/mysql/mysql.sock \
\ –with-iodbc=shared,/usr –enable-pdo=shared –with-pdo-mysql=shared,mysqlnd \
\ –with-pdo-sqlite=shared,/usr –with-pdo-odbc=shared,iODBC,/usr –with-pspell=shared,/usr \
\ –with-enchant=shared,/usr –enable-shmop=shared –with-snmp=shared,/usr \
\ –enable-soap=shared –enable-sockets –with-sqlite3=shared –enable-sysvmsg \
\ –enable-sysvsem –enable-sysvshm –with-xsl=shared,/usr –with-zip=shared \
\ –with-tsrm-pthreads –enable-intl=shared –enable-opcache –enable-shared=yes \
\ –enable-static=no –with-gnu-ld –with-pic –enable-phpdbg –with-sodium \
\ –with-password-argon2 –without-readline –with-libedit –with-pear \
\ –with-tidy=shared –build=i586-slackware-linux
\# I am told this option is worse than nothing. 🙂
\# –enable-safe-mode
\# I would recommend *against* and will take no responbility for turning on
\# “safe” mode.
$ make
$ mkdir ~/package-php
$ make install INSTALL_ROOT=~/package-php (以降、エラーがなければsudoで実行)
$ rm -rf ~/package-php
$ sudo chown -R root.root ../php-7.4.11
$ sudo mkdir -p ~/package-php/etc/httpd
$ sudo mkdir -p ~/package-php/etc/php.d
\# A trick from DaMouse to enable building php into $PKG.
\# We’ll remove this later on.
$ sudo sh -c ‘cat /etc/httpd/original/httpd.conf > ~/package-php/etc/httpd/httpd.conf’
$ if [ ! -e /etc/httpd/original/httpd.conf ]; then
\ echo “FATAL: no /etc/httpd/original/httpd.conf found.”
\ exit 1
\fi
(httpd.confは既にあって、運用していれば書き換えている。phpを入れたら
https://seesaawiki.jp/lifewithslackzaurus/d/HTML/CSS/JavaScript%a4%ce%ce%fd%bd%ac%20local%20Web%a5%b5%a1%bc%a5%d0
\httpd.confを設定し直せってことか?上書きされるとマズイので念のためにbackを取っておく)
$ sudo cp -a -i /etc/httpd/httpd.conf /etc/httpd/original/httpd.conf.bak
$ sudo make install INSTALL_ROOT=~/package-php
$ cd ~/package-php
$ sudo mkdir -p etc/{rc.d,php-fpm.d}
$ sudo cp ~/php-7.4.11/sapi/fpm/init.d.php-fpm $PKG/etc/rc.d/rc.php-fpm.new
$ sudo chmod 644 etc/rc.d/rc.php-fpm.new
\# PHP (used to) install Pear with some strange permissions.
$ sudo chmod 755 usr/bin/pear
\# PHP sometimes puts junk in the root directory:
$ sudo rm -rf .channels .depdb .depdblock .filemap .lock .registry
\# We do not package static extension libraries:
$ sudo rm -f usr/lib/php/extensions/*.a
\# Fix $PKG/usr/lib/php perms:
$ ( cd usr/lib/php
\ sudo find . \
\ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
\ -exec chmod 755 {} \; -o \
\ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
\ -exec chmod 644 {} \;
\)
$ sudo mkdir -p usr/doc/php-7.4.11
$ sudo cp -a \
\ ~/php-7.4.11/{CODING_STANDARDS*,CONTRIBUTING*,EXTENSIONS*,LICENSE*,NEWS*,README*,UPGRADING*} \
\ usr/doc/php-7.4.11
$ sudo mkdir -p etc/httpd
$ sudo sh -c ‘cat /mnt/card/slackware-current/source/n/php/mod_php.conf.example | sed -e “s#lib/httpd#lib/httpd#” > etc/httpd/mod_php.conf.new’
$ sudo chmod 644 etc/httpd/*
$ sudo chown root:root etc/httpd/*
$ sudo cp -a php.ini-development php.ini-production etc
$ sudo chmod 755 etc/php.d etc/php-fpm.d etc/httpd
$ sudo chown root:root etc/*
\# This can go now.
$ sudo rm -f etc/httpd/httpd*
\# Session directory for PHP:
$ sudo mkdir -p var/lib/php
$ sudo chmod 770 var/lib/php
$ sudo chown root:apache var/lib/php
\# Strip ELF objects.
$ sudo find $PKG | xargs file | grep -e “executable” -e “shared object” | grep ELF \
\ | cut -f 1 -d : | xargs strip –strip-unneeded
$ sudo gzip -9 $PKG/usr/man/man?/*.?
$ sudo mkdir -p install
$ sudo sh -c ‘zcat /mnt/card/slackware-current/source/n/php/doinst.sh.gz > install/doinst.sh’
$ sudo sh -c ‘cat /mnt/card/slackware-current/source/n/php/slack-desc > install/slack-desc’
$ sudo makepkg ../php-7.4.11-i586-1.tgz
$ sudo installpkg ../php-7.4.11-i586-1.tgz

alpine-2.25:
(http://ftp.kddilabs.jp/Linux/distributions/Slackware/slackware-current/source/n/alpine/alpine.SlackBuild を参考に、)
(http://ftp.kddilabs.jp/Linux/distributions/Slackware/slackware-14.2/source/n/alpine/alpine.SlackBuild を参考に、)
$ tar xpf /mnt/card/slackware-current/source/n/alpine/alpine-2.25.tar.lz
$ cd alpine-2.25
$ zcat /mnt/card/slackware-current/source/source/n/alpine/alpine.manpage.diff.gz | patch -p1
$ zcat /mnt/card/slackware-current/source/source/n/alpine/maildir.patch.gz | patch -p1
\# Configure:
$ CFLAGS=”-O2 -march=i586 -mtune=i686″ ./configure \
\ –prefix=/usr –mandir=/usr/man –with-ssl-dir=/usr \
\ –with-ssl-certs-dir=/etc/ssl/certs –with-c-client-target=slx \
\ –with-system-pinerc=/etc/pine.conf –with-system-fixed-pinerc=/etc/pine.conf.fixed \
\ –with-passfile=.alpine.passfile –disable-debug –with-debug-level=0 \
\ –without-tcl –program-prefix= –program-suffix= –build=i586-slackware-linux
configure: * * * S/MIME support enabled
configure: * * * No certificates found in “/etc/ssl/certs”.
configure: * * * This might indicate that CA certs did not get properly
configure: * * * installed. If you get certificate validation failures
configure: * * * in Alpine, this might be the reason for them.
configure: * * * Including Kerberos5 functionality
configure: * * * TCL libraries could not be found.
configure: * * * WEB ALPINE COMPONENT WILL NOT BE BUILT.
(TCL-lib入れるか。いやtcl/tkはspitzでさえ既に入っている。–without-tcl Disable TCL, thus Web Alpine support となっているし無視した)
\# Correct paths and programs in tech-notes.txt:
$ ( cd doc/tech-notes
\ sed -i “s,/usr/local/lib/pine.info,/usr/lib/pine.info,g” tech-notes.txt
\ sed -i “s,/usr/local/lib,/etc,g” tech-notes.txt
\ sed -i “s,/usr/local,/etc,g” tech-notes.txt
\)
\# Build and install:
\# Since we build non-compliant to RFC3501 we have to answer ‘y’ half-way:
$ echo y | make EXTRACFLAGS=”-fPIC” SSLTYPE=unix
$ mkdir ~/package-alpine
$ make install SSLTYPE=unix DESTDIR=~/package-alpine (エラーが無ければ以降sudoで実行)
$ rm -rf ~/package-alpine
$ sudo mkdir -p ~/package-alpine/etc
$ sudo chown -R root.root ../alpine-2.25
こりゃさすがに酷いpermだ。chmodしないとroot以外アクセスできない。
$ sudo find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 700 -o -perm 555 -o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
$ sudo make install SSLTYPE=unix DESTDIR=~/package-alpine
\# Add default config file:
$ sudo sh -c ‘./alpine/alpine -conf > ~/package-alpine/etc/pine.conf.new’
\# Add a documentation directory:
$ sudo mkdir -p ~/package-alpine/usr/doc/alpine-2.25
$ sudo cp -a \
\ LICENSE NOTICE README* VERSION \
\ doc/tech-notes* doc/brochure.txt doc/mailcap.unx doc/mime.types \
\ ~/package-alpine/usr/doc/alpine-2.25
\# Add pinepgp support:
$ cd ~/
$ tar xpf /mnt/card/slackware-current/source/n/alpine/pinepgp-0.18.0.tar.gz
$ cd ~/pinepgp-0.18.0
$ zcat /mnt/card/slackware-current/source/n/alpine/pinepgp-0.18.0-makefile-sed-fix.diff.gz | patch -p1
$ zcat /mnt/card/slackware-current/source/n/alpine/pinepgp.pinegpgp.in.diff.gz | patch -p1
$ ./configure –prefix=/usr
checking for gpg… no
configure: error: No filters to build.
(gnupg入れてない?)
https://seesaawiki.jp/lifewithslackarmzaurus_15_0/d/OpenSSL%a1%a2GnuPG%a1%a2GnuTLS
(opensslしか入れてなかった。入れておこう。spitzと同じ物を入れたはずなのだが。忘れた?)
$ ./configure –prefix=/usr
$ make
$ mkdir ~/package-pinepgp
$ make install DESTDIR=~/package-pinepgp (エラーが無ければ以降sudoで実行)
$ rm -rf ~/package-pinepgp
$ sudo chown -R root.root ../pinepgp-0.18.0
$ sudo make install DESTDIR=~/package-alpine
$ sudo mkdir -p ~/package-alpine/usr/doc/pinepgp-0.18.0
$ sudo cp -a COPYING* README ~/package-alpine/usr/doc/pinepgp-0.18.0
$ cd ~/package-alpine
$ sudo chmod 644 usr/doc/pinepgp-0.18.0/*
$ sudo gzip -9 usr/man/man?/*.*
\# Strip binaries:
$ find . | xargs file | grep -e “executable” -e “shared object” | grep ELF \
\ | cut -f 1 -d : | xargs sudo strip –strip-unneeded
\# Compress info files, if any:
(usr/infoは無い)
$ sudo mkdir -p install
$ sudo sh -c ‘cat /mnt/card/slackware-current/source/n/alpine/doinst.sh.alpine > install/doinst.sh’
$ sudo sh -c ‘cat /mnt/card/slackware-current/source/n/alpine/slack-desc.alpine > install/slack-desc’
$ sudo makepkg ../alpine-2.25-i586-1.tgz
$ sudo installpkg ../alpine-2.25-i586-1.tgz
(slackbuildではinstallまで実行していないが、今回は入れておくことにする)
\
\# As is customary, now build a package for the included IMAP and
\# POP3 daemons:
(defでは BUILD_IMAPD==NO だが、krb5の方で for_IMAP_support としているので入れることにする。
\Slack-14.2ではalpineがimapdの提供元になっているというのもある)
$ cd ~/alpine-2.25/imap
$ sudo mkdir -p ~/package-imapd/usr/sbin
$ cd imapd; CFLAGS=”-O2 -march=i586 -mtune=i686″ sudo make
$ cd ../ipopd; CFLAGS=”-O2 -march=i586 -mtune=i686″ sudo make
$ cd ..
$ sudo sh -c ‘cat imapd/imapd > ~/package-imapd/usr/sbin/imapd’
$ sudo sh -c ‘cat ipopd/ipop3d > ~/package-imapd/usr/sbin/ipop3d’
$ sudo chmod 755 ~/package-imapd/usr/sbin/imapd ~/package-imapd/usr/sbin/ipop3d
\# Strip binaries:
$ find ~/package-imapd | xargs file | grep -e “executable” -e “shared object” \
\ | grep ELF | cut -f 1 -d : | xargs sudo strip –strip-unneeded
$ sudo mkdir -p ~/package-imapd/usr/doc/imapd-2.25
$ sudo cp -a CONTENTS LICENSE* NOTICE SUPPORT* ~/package-imapd/usr/doc/imapd-2.25
$ sudo sh -c ‘cat < ~/package-imapd/usr/doc/imapd-2.25/additional-imap-documentation
\ Additional documentation for imapd may be found in the alpine sources in the /imap/docs
\ directory.
\ EOF’
$ sudo mkdir -p ~/package-imapd/usr/man/man8
$ sudo sh -c ‘for file in src/imapd/imapd.8 src/ipopd/ipopd.8 ; do
\ cat $file | gzip -9c > ~/package-imapd/usr/man/man8/`basename $file`.gz
\ done’
\# Add slack-desc file:
$ cd ~/package-imapd
$ sudo mkdir -p install
$ sudo sh -c ‘cat /mnt/card/slackware-current/source/n/alpine/slack-desc.imapd > install/slack-desc’
$ sudo makepkg ../imapd-2.25-i586-1.tgz
$ sudo installpkg ../imapd-2.25-i586-1.tgz

メールコマンドも入れておいた:
$ sudo installpkg /mnt/card/slackware-14.2/slackware/n/mailx-12.5-i586-2.txz

 

参考情報:
Why php is not being updated on Slack 14.2?
https://www.linuxquestions.org/questions/slackware-14/why-php-is-not-being-updated-on-slack-14-2-a-4175689032/
LPI Linux 認定試験 Level1 平成14年版 にはexprコマンドは無かったが今はあるのか:
オライリーの分厚いリファレンス本(2002.03)にも載ってない。
https://linuc.org/study/samples/1277/
https://atmarkit.itmedia.co.jp/ait/articles/1712/28/news019.html
よく見るとbcコマンドも載ってない。bcコマンド載せてほしいなぁ。
https://seesaawiki.jp/lifewithslackzaurus/d/bc
linux mail コマンド、でググった:
https://monologu.com/mail-command/
https://qiita.com/shuntaro_tamura/items/40a7d9b4400f31ec0923

installまたは展開時のメッセージ:
\# alpine (Alternatively Licensed Program for Internet News and Email)
\# Alpine is a fast, easy to use email client that is suitable for both
\# the inexperienced email user as well as for the most demanding of
\# power users. Alpine is based on the Pine(R) Message System, which
\# was also developed at the University of Washington. Alpine can be
\# learned by exploration and the use of context-sensitive help. The
\# user experience is highly customizable through the use of the Alpine
\# Setup command.
\# Homepage: https://repo.or.cz/alpine.git
\
\# imapd (IMAP4rev1 from alpine)
\# /usr/sbin/ipop3d and /usr/sbin/imapd are servers supporting the POP3
\# and IMAP remote mail access protocols. They allow users to download
\# mail from your Linux system for remote viewing.
\
\# mailx (a simple mail client)
\# Mailx is derived from Berkeley Mail and is intended provide the
\# functionality of the POSIX mailx command with additional support
\# for MIME, IMAP, POP3, SMTP, and S/MIME. It provides enhanced
\# features for interactive use, such as caching and disconnected
\# operation for IMAP, message threading, scoring, and filtering.
\# It is also usable as a mail batch language, both for sending
\# and receiving mail.
\# The maintainer and primary developer of mailx is Gunnar Ritter.
\

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です