PHPを7.3にアップグレードしたら Slim Jetpackがエラーを吐く

エラーは

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Jetpack has a deprecated constructor in /XXXXXXXX/wp-content/plugins/slimjetpack/class.jetpack.php on line 25

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Jetpack_User_Agent_Info has a deprecated constructor in /XXXXXXXXX/wp-content/plugins/slimjetpack/class.jetpack-user-agent.php on line 61

Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /XXXXXXXXXXX/wp-content/plugins/slimjetpack/modules/infinite-scroll/infinity.php on line 147

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Sharing_Service_Total has a deprecated constructor in /XXXXXXXX/wp-content/plugins/slimjetpack/modules/sharedaddy/sharing-service.php on line 352

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Sharing_Post_Total has a deprecated constructor in /XXXXXXXX/wp-content/plugins/slimjetpack/modules/sharedaddy/sharing-service.php on line 374

と5箇所もエラーになった。先ずは上から1番目、/wp-content/plugins/slimjetpack/modules/sharedaddy/sharing-service.php on line 352 は

/** private function Jetpack() { */                ←コメントアウト これは220行目だった
private function __construct() {                     ←挿入

上から2番目、/wp-content/plugins/slimjetpack/class.jetpack-user-agent.php on line 61は

/**function Jetpack_User_Agent_Info()         ←コメントアウト これは99行目
{ */
function __construct() {                                   ←挿入

上から3番目、/wp-content/plugins/slimjetpack/modules/infinite-scroll/infinity.php on line 147は

continue;    → continue 2;

break;          → //break;

上から4番目と5番目は、/wp-content/plugins/slimjetpack/modules/sharedaddy/sharing-service.php on line 352 と line 374 は

//public function Sharing_Service_Total( $id, $total ) {   ← コメントアウト
public function __construct( $id, $total ) {                          ← 挿入

//public function Sharing_Post_Total( $id, $total ) {        ← コメントアウト
public function __construct( $id, $total ) {                          ← 挿入

これでエラーは出なくなった。

カテゴリー: Linux運用時のメモ | コメントする

WordPress を5.3にアップグレードしたらエラーになった

エラーはダッシュボードにアクセスする時だけ下記のエラーが出る

Notice: add_submenu_page が誤って呼び出されました。add_submenu_page() に渡される第7引数はメニュー位置を示す整数値である必要があります。 詳しくは WordPress のデバッグをご覧ください。 (このメッセージはバージョン 5.3.0 で追加されました) in /webdata/public/kinryo/wp-includes/functions.php on line 4903

となっているので、いろいろ調べたが私の能力では直せなかったので、強引にこの行をコメントアウトしたら、エラーは無くなった。これはサブメニューに関する記述なので、ダッシュボードの各サブメニューを表示したが特に問題は無かったので良しとしている。どなたかちゃんと直せる方がいましたら教えて下さい。

カテゴリー: Linux運用時のメモ | コメントする

wordpressのWEBでFAVICON.ICOを消したい。

前に使用していたfaviconを変更しようとし、その設定をgoogle先生に聞くと、テーマのheader.phpに設定する方法と、プラグインを使う方法で設定があるとあったが、使用中のheader.phpにfavicon.icoは無いし、ファビコンのプラグインも入れていない。

一体どこにあるのだと、途方に暮れたが、幸いWEBのコンテンツは自分のWEBサーバーにあるので、検索をかけると色々なfavicon.icoが出てきて、その内の一つが使用中のものでした。

私のWEBの構成は下記の様にドメインの下に各国のフォルダーを作りそこにwordpressをインストールしています。(ドメインは inpac.jpでこれは/xxxxx/public/inpacに設定)

/xxxxx/public/inpac/maldives

/xxxxx/public/inpac/india

/xxxxx/public/inpac/srilanka

見たいになっており、このinpacディレクトリーにfavicon.icoがあった。これが表示されていたようでした。これを削除するとファビコンは表示されなくなりました。このWEBはapacheを使用していますが、apacheの仕様がそうなっているのかな?

カテゴリー: Linux運用時のメモ | コメントする

fstabで指定したディレクトリは無ければ自動で作ってくれる!!(CentOS 7)

ある時 、新しいボリュームを新規に作るdirectory にマウントする為に /etc/fstab を修正し、mount -a でなく再起動した。その際うっかり新しいdirectoryを作るのを忘れていたら、何と無いdirectoryをデフフォルトのアクセス権で自動的に作ってくれた!!(centOS 6 ではヱラーになる)

カテゴリー: Linux運用時のメモ | コメントする

Bacula make_mysql_tables でエラー

mysql は Ver 14.14 Distrib 5.6.43 ですが、5.5 でも起きるみたいです。https://bugzilla.redhat.com/show_bug.cgi?id=724894 の Here is the patch found on the bacula mantis:  に回答がありました。只、私の make_mysql_tables スクリプトは 322行目ではなく、325行目でしたので、@@ -322,12 +322,12 @@ の部分は @@ -325,12 +325,12 @@ になります。その訂正した分のパッチは

-- make_mysql_tables.orig 2010-02-15 16:05:14.000000000 +0200
+++ make_mysql_tables 2010-02-15 16:09:50.000000000 +0200
@@ -325,12 +325,12 @@

-CREATE TABLE Counters (
- Counter TINYBLOB NOT NULL,
- MinValue INTEGER DEFAULT 0,
- MaxValue INTEGER DEFAULT 0,
- CurrentValue INTEGER DEFAULT 0,
- WrapCounter TINYBLOB NOT NULL,
+CREATE TABLE \`Counters\` (
+ \`Counter\` TINYBLOB NOT NULL,
+ \`MinValue\` INTEGER DEFAULT 0,
+ \`MaxValue\` INTEGER DEFAULT 0,
+ \`CurrentValue\` INTEGER DEFAULT 0,
+ \`WrapCounter\` TINYBLOB NOT NULL,
PRIMARY KEY (Counter(128))
);

カテゴリー: Linux運用時のメモ | コメントする

10:アンチウイルスソフト導入(Clam AntiVirus)

現在は11:Sophosアンチウィルスを使用しています。
Clam AntiVirusインストール 参考:https://centossrv.com/clamav.shtml
# yum -y install clamav clamav-server clamav-server-systemd clamav-update clamav-scanner
ウイルス定義ファイル更新設定ファイル編集
# gedit /etc/freshclam.conf
で、Exampleはコメントアウトしてあった(# Exanple)
NotifyClamd /etc/clamd.d/scan.conf ← 追加(ウイルス定義ファイル更新をclamdに通知する)
保存後、/etc/sysconfig/freshclam を編集するが
#FRESHCLAM_DELAY= ← 既に、行頭に#を追加してあった
で、ウイルス定義ファイル最新化をする
# freshclam
あれー、エラーが出た。
ERROR: Please edit the example config file /etc/clamd.d/scan.conf
ERROR: NotifyClamd: Can't find or parse configuration file /etc/clamd.d/scan.conf
/etc/clamd.d/scan.confを編集しろとある
このファイルの8行目位にある Exampleの前に # を着けコメントアウトし、保存後再度
# freshclam
今度は無事終了した。
カテゴリー: CentOS7に挑戦 | コメントする

9:rootkit検知ツール導入(chkrootkit)

schkrootkitのインストール
# wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
chkrootkit.tar.gzを展開する
# tar zxvf chkrootkit.tar.gz
実行ファイルを/binに移動する
# mkdir -p ~/bin && mv chkrootkit-0.50/chkrootkit ~/bin
ダウンロードしたファイルと展開先ディレクトリーを削除
# rm -f chkrootkit.tar.gz
# rm -rf chkrootkit-0.50

chkrootkitの実行
# chkrootkit | grep INFECTED
変なファイルが無ければ、何も表示されないが
Searching for Linux.Xor.DDoS … INFECTED: Possible Malicious Linux.Xor.DDoS installed
と表示された!!
私の先生のcentossrv.comの質問掲示板にも同様の書き込みがhttps://centossrv.com/patio/centossrv.cgi?read=3066
ここを見ると、どうも誤検知みたいだ。
# find /tmp -executable -type f
/tmp/ks-script-DuXVBx と表示された。
このks-script-DuXVBxの実行権限を外して、再度
# chkrootkit | grep INFECTED
では何も表示されなかった。
毎日chkrootkitを動かすスクリプトを作る
# gedit /etc/cron.daily/chkrootkit

#!/bin/sh
PATH=/usr/bin:/bin:/root/bin
LOG=/tmp/$(basename ${0})
# chkrootkit実行
chkrootkit > $LOG 2>&1
# ログ出力
cat $LOG | logger -t $(basename ${0})
# SMTPSのbindshell誤検知対応
if [ ! -z "$(grep 465 $LOG)" ] && \
[ -z $(/usr/sbin/lsof -i:465|grep bindshell) ]; then
sed -i '/465/d' $LOG
fi
# upstartパッケージ更新時のSuckit誤検知対応
if [ ! -z "$(grep Suckit $LOG)" ] && \
[ -z "$(rpm -V rpm -qf /sbin/init)" ]; then
sed -i '/Suckit/d' $LOG
fi
# rootkit検知時のみroot宛メール送信
[ ! -z "$(grep INFECTED $LOG)" ] && \
grep INFECTED $LOG | mail -s "chkrootkit report in hostname" root

これで万が一 rootkitがインストールされ場合はメールが来る。
この後、https://centossrv.com/chkrootkit.shtml
を参考にコマンド群の退避を行っておく。
カテゴリー: CentOS7に挑戦 | コメントする

8:ファイル改竄検知システム Tripwireの導入

ここはhttp://centossrv.com/tripwire.shtml
の受け売りで

# yum -y install tripwire ← tripwireインストール 
# tripwire-setup-keyfiles ← tripwire初期設定

設定するためにサイトパスフレーズを2回聞かれ、ローカルパスフレーズも2回聞いてきます。さらにサイトパスフレーズを2回聞いてきます。のでサイトパスフレーズとローカルパスフレーズを控えておきます。ここもhttp://centossrv.com/tripwire.shtm
を参考にしています。Tripwire設定 をしていきます。

# gedit /etc/tripwire/twcfg.txt

上の図のように2ヶ所変更し保存

# twadmin -m F -c /etc/tripwire/tw.cfg -S /etc/tripwire/site.key /etc/tripwire/twcfg.txt ← Tripwire設定ファイル(暗号署名版)作成

サイトパスフレーズを聞かれます。そして.txtファイルを削除しておく

# rm -f /etc/tripwire/twcfg.txt ← Tripwire設定ファイル(テキスト版)削除
※Tripwire設定ファイル(テキスト版)を復元する場合
# twadmin -m f -c /etc/tripwire/tw.cfg > /etc/tripwire/twcfg.txt
# gedit /etc/tripwire/twpolmake.pl
#!/usr/bin/perl
# Tripwire Policy File customize tool
# ----------------------------------------------------------------
# Copyright (C) 2003 Hiroaki Izumi
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# ----------------------------------------------------------------
# Usage:
# perl twpolmake.pl {Pol file}
# ----------------------------------------------------------------
#
$POLFILE=$ARGV[0];
open(POL,"$POLFILE") or die "open error: $POLFILE" ;
my($myhost,$thost) ;
my($sharp,$tpath,$cond) ;
my($INRULE) = 0 ;
while (<POL>) { chomp;
if (($thost) = /^HOSTNAME\s*=\s*(.*)\s*;/) {
$myhost = `hostname` ; chomp($myhost) ;
if ($thost ne $myhost) {
$_="HOSTNAME=\"$myhost\";" ;
}
}
elsif ( /^{/ ) {
$INRULE=1 ;
}
elsif ( /^}/ ) {
$INRULE=0 ;
}
elsif ($INRULE == 1 and ($sharp,$tpath,$cond) = /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/) {
$ret = ($sharp =~ s/\#//g) ;
if ($tpath eq '/sbin/e2fsadm' ) {
$cond =~ s/;\s+(tune2fs.*)$/; \#$1/ ;
}
if (! -s $tpath) {
$_ = "$sharp#$tpath$cond" if ($ret == 0) ;
}
else {
$_ = "$sharp$tpath$cond" ;
}
}
print "$_\n" ;
} close(POL) ;
# perl /etc/tripwire/twpolmake.pl /etc/tripwire/twpol.txt > /etc/tripwire/twpol.txt.new ← ポリシーファイル最適
# echo ! "/var/lib/tripwire/hostname.twd ;" >> /etc/tripwire/twpol.txt.new ← Tripwireデータベース自体をチェック対象外にする
# echo ! "/tmp/tripwire.log ;" >> /etc/tripwire/twpol.txt.new ← Tripwireログをチェック対象外にする※後述のTripwire定期自動実行スクリプトで使用
# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new ← 最適化済ポリシーファイルを元にポリシーファイル(暗号署名版)作成
# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new ← 最適化済ポリシーファイルを元にポリシーファイル(暗号署名版)作成サイトパスフレーズ

サイトパスフレーズを聞いてくるので入力するとポリシーファイルを作る。

rm -f /etc/tripwire/twpol.txt* ← ポリシーファイル(テキスト版)削除
※ポリシーファイル(テキスト版)を復元する場合
twadmin -m p -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key > /etc/tripwire/twpol.txt

データベース作成

# tripwire -m i -s -c /etc/tripwire/tw.cf

ローカルパスフレーズを聞いてくるので入力、そして
Tripwire確認

# tripwire -m c -s -c /etc/tripwire/tw.cfg

結構なファイルをチェックしているので時間がかかるが、レポートが表示されればOK

カテゴリー: CentOS7に挑戦 | コメントする

7:EPELレポジトリーの導入

先ずは、CentOSの レポジトリーに無いものがいっぱいあるので、EPELをいれます。

# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum -y install yum-plugin-versionlock

として、レポジトリーとバージョンロックをいれます。

/etc/yum.repos.d/にepel.repoが入っている筈です

カテゴリー: CentOS7に挑戦 | コメントする

6:初期設定ー色々

この辺の設定は私の先生であるhttp://centossrv.com/
を参考にしています。
アップデートを夜に自動でするためにyum-cronをいれます。

# yum -y install yum-cron
# systemctl start yum-cron ← パッケージ自動更新起動
# systemctl enable yum-cron ← パッケージ自動更新自動起動設定

次に開発関連のプログラムをいれます。

# yum -y groupinstall base "Development tools" ← ベース、開発ツールパッケージ群インストール

rootのメールを自分のメアドに送る設定

# gedit /etc/aliases

上の画像のように自分のメアドを設定し保存。

# newaliases ← 転送設定反映
# echo test|mail root ← テストメールをroot宛に送信す

自分のメアドにメールがきている事を確認
selinuxを無効にする(本当は有効の方がいいのだが、私の技量では未だ追いついていけないので

# getenforce ← SELinux状態確認
Enforcing ← SELinux有
# setenforce 0 ← SELinux無効化
# getenforce ← SELinux状態確認
Permissive ← SELinux無

このままでは再起動後に有効になってしまいますので

# gedit /etc/sysconfig/selinux ← SELinux設定ファイル編集

SELINUX=をdisabled にして保存
日本語処理に必要なnkfコマンドをインストールする

# wget "http://sourceforge.jp/frs/redir.php?m=jaist&f=%2Fnkf%2F59912%2Fnkf-2.1.3.tar.gz" -O nkf-2.1.3.tar.gz ← nkfダウンロード
# tar zxvf nkf-2.1.3.tar.gz ← nkf展開
# cd nkf-2.1.3/ ← nkf展開先ディレクトリへ移動
# make && make install ← nkfインストール
# cd ← nkf展開先ディレクトリを抜ける
# rm -rf nkf-2.1.3 ← nkf展開先ディレクトリを削除
# rm -f nkf-2.1.3.tar.gz ← ダウンロードしたnkfを削除
# ln -s /usr/local/bin/nkf /usr/bin/nkf ← /usr/local/bin/nkfから/usr/bin/nkfへリンクをはる
カテゴリー: CentOS7に挑戦 | コメントする