V-antena and Tanimoto's page

谷本の備忘録・雑記帳・work

>

カテゴリー: PC-OS-IT

CATEGORY ARCHIVE

PHP version up from PHP7.3 to PHP7.4 by WordPress request

WordPressの管理画面からPHPをPHP7.4へバージョンアップしろと怒られたので、PHPをPHP7.3からPHP7.4へ更新したのでその記録です。OSはRaspberry OS、ブラウザはApacheです。

環境
OS: Raspberry OS (Buster)
Brawser: Apache2
WordPress: Version 5.4
PHP: PHP7.3

Step1: PHP更新用のリポジトリーを登録する

どのリポジトリーが良いのかわからなかったけど、https://emc-craft.xyz/raspberrypi/php74-inst/ を参考にしてpackages.sury.org を登録した。

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update

Step2: PHPを更新する

PHP7.3の時は、php-mbstringでインストールしたが今回それで行うとphp8.0-mbstringがインストールされ、まだダメとWordPressに怒られる。従って、php7.4-mbstringと指定すること。

sudo apt remove php*
sudo apt install php7.4
sudo apt install php7.4-zip php7.4-mysql php7.4-xml php7.4-gd  php7.4-curl
sudo apt install php7.4-mbstring

Step3: Apache2の設定を更新する

これを行っていないと、WordPressからPHP7.3だと怒られる。

sudo a2dismod php7.3
sudo a2enmod php7.4

Step4: php.iniを再設定する

php.iniの設定値は、https://www.javadrive.jp/php/install/index8.html のサイトに従った。

sudo nano  /etc/php/7.4/apache2/php.ini

下記を設定
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = pass
mbstring.http_output = pass
mbstring.encoding_translation = Off
mbstring.detect_order = UTF-8,SJIS,EUC-JP,JIS,ASCII
mbstring.substitute_character = none
mbstring.func_overload = 0
mbstring.strict_detection = Off

Step5: Apacheを再起動する

sudo systemctl restart apache2

それに伴い、過去の投稿が無くなっていたり変更があります。

変更の経緯

Raspberry piで運用していたためSDカードの寿命が心配なのと、旧い版数なのでSD copierが使えずバックアップも取れないこと、スパムが多いため対応をしたいというのが理由でした。

主な変更

raspberry pi 3 B から raspberry pi 4 B へ変更
raspbian(wheezy) から raspberry OS (buster)へ変更
クラシックエディターからGutenbergに変更
テーマをtwentyfourteenから、自作のテーマへ変更

などです。

手こずった点などを記録として残す。

物の準備

raspberry pi 4 + SSD で運用しようとした。 手順を誤ったため不必要な物まで購入するはめになってしまった。

  • raspberry pi 4 4B (4GB) 6069円
  • SDHCカード
  • アーマー金属ケース パッシブ冷却     1590円
  • HDMI-microHDMIケーブル  (ヘッドレスインストールの仕方を先に確認しておけば購入しなくともよかったのに・・・)
  • 電源アダプター(5V3A対応) ※なかなか売っていなくて時間がかかった。本体と一緒にネットで購入するほうが時間的にも価格的にも良い。
  • ポータブルSSD (不良品で途中からエラー頻発。保証書で交換してもらった。交換後は問題なし)
  • LAN用スイッチングHub ( wordpress移行中に2つのサーバーを同時に使用するため必要)

(検品:やらずやり直しの羽目になってしまった)

SSDに問題ないか購入後確認する。
別のubuntu OSのPCから、

sudo badblocks -s -v /dev/sdc
にてリードエラーがないかを確認する。  なお、sdcは適宜合わせる。

SSDブートまでもっていく

※SDHCカードを作ってからSSDにコピーしたが、今は、直接SSDに書き込めるようである。

  • Raspi imagerを、https://www.raspberrypi.org/software/ からdownloadする
  • (SDHCに書き込む)
  • (SDHCからブートし、立ち上げ中に出てくる質問等に答えて立ち上げる)
  • (SSHを有効にする)
  • (xrdpをインストールする)
    sudo apt install xrdp
  • SSDを取り付けて、SD copierでSSDに書き込む
  • (power offし、SDHCを抜き)SSDから立ち上げる
  • ※ SSDに直接書き込んだ場合は、この後、SSH有効化及びxrdpのinstallする。
  • これ以降、HDMIインターフェイス及びキーボード、マウスの直結は不要となる。

WordPressをインストールし、新規投稿をしようとすると、「更新に失敗しました。 返答が正しい json レスポンスではありません。」と表示されるトラブルが起こった。 その際に行った対応策を備忘録として残す。

私の場合、2つの原因があった。

原因1: Apacheにrewriteを登録するのを忘れていた。

対応1: 以下のコマンドを実行しApache再起動
sudo a2enmod rewrite

原因2: Apacheにoverrideを許可していなかった

対応2: 下記の様にConfigファイルを修正してoverrideを許可した。その後Apache再起動。
sudo nano /etc/apache2/apache2.conf
以下のところを変更 (AllowOverrideの値をNoneからAllへ変更)

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

WordPressで画面を遷移しようとした時に、「サイトに重大なエラーがありました」と表示されたので、原因を調べる際に行った事。

対応方針:デバッグモードにして問題個所を調べた。

sudo nano /var/www/html/wordpress/wp-config.php
にて、configファイル内容を変更してデバッグモードにして調べた。

変更前: define( 'WP_DEBUG', false );

変更後: define( 'WP_DEBUG', true );

恵安の2inタブレット(32GB)でのwindows10 update

恵安の2inタブレット(KBM100K windows10 64bit emmc 32GB)を使っているが、容量が少なくてどうしても大型のwindows updateが出来なかった。それで、windows10のクリーンインストールしたところwifi用のデバイスBroadcom 802.11ac WDI SDIO Adapterがcode 10で開始しない。
 いろいろネットで調べたがなかなかわからなかったが、最終的に対処できたので、記録として残す。

I have a Keian's tablet PC KBM100K (windows 10 64bit ,emmc 32GB). And it had encounterd a difficulty of majar windows update by shortage of storage capacity of C drive. So I did clean installtion of windows 10 into my tablet.

But unfortunately a code 10 error occured at the wifi device driver for Broadcom 802.11ac WDI SDIO Adapter.

After many struggles, I could fix that problem. So Irecord the measures.

1.タブレット
  KEIAN KBM100K windows10 64bit 64bit emmc 32GB

  1. My tablet PC
    KEIAN KBM100K windows10 64bit 64bit emmc 32GB
  1. トラブルの内容
    Broadcom 802.11ac WDI SDIO Adapte (code 10)
    ※This Device Cannot start (Code 10)
  1. Description of the trouble.
    Broadcom 802.11ac WDI SDIO Adapte (code 10)
    ※This Device Cannot start (Code 10)
  1. 対処
    3.1 Fix of problem 3.1 デバイスドライバーを1.596.12.1にするMicrosoft Update カタログ(*1)から Broadcom 802.11ac WDI SDIO Adapterで検索し、 「Windows 10 and Later Servicing Drivers for testing, Windows 10 Anniversary Update and Later Servicing Drivers 」 バージョン 1.596.12.1 をダウンロードし、デバイスマネージャーを 使ってドライバを更新する。 (*1) https://www.catalog.update.microsoft.com/Home.aspx

3.1 Update the device driver to version 1.596.12.1
Access the Microsoft Update catalog(*1) and search the corresponding drivers with 'Broadcom 802.11ac WDI SDIO Adapter'. Then download the driver ( Windows 10 and Later Servicing Drivers for testing, Windows 10 Anniversary Update and Later Servicing Drivers) version 1.596.12.1 and update the device driver with the downloaded driver by using Device Manager.
(*1) https://www.catalog.update.microsoft.com/Home.aspx

3.2 4345r6nvram.txtを入手し、c:\windows/system32/drivers フォルダーに入れ、windowsを再起動する
もしかしたら、元のマシンにあったかも知れないが、クリーンインストール後であったので、私の場合、恵安のwebサイトから入手した。

https://www.keian.co.jp/support/download/ にアクセスし、windows製品, KBM100K, ドライバーを選択し、KBM100K、KBM85B WiFi,Bluetooth ドライバーをダウンロードすると、KBM100K-KBM85B-WIFI-BT-driver.zip が、得られるので、その中にある 4345r6nvram.txt をコピペで c:\windows/system32/drivers に入れる事で対処した。 再起動したらwifiが繋がるようになった

3.2 Get 4345r6nvram.txt, insert it into the c:\windows/system32/drivers folder and restart the windows.

I forgot to check the file in the tablet. So I got it from KEIAN's web site.
Access https://www.keian.co.jp/support/download/ and select windows製品, KBM100K, ドライバー.
(Only Japanese languaage available )
Then download KBM100K、KBM85B WiFi,Bluetooth ドライバー.
At this point, You got the KBM100K-KBM85B-WIFI-BT-driver.zip file, and You can take the '4345r6nvram.txt' file from the zip.file.

Finally insert it into the 'c:\windows/system32/drivers' folder, and restart the windows.
In my case, the my tablet works well. Success!!

  1. 参考 windows 10のクリーンインストール (USBメモリを使用)
    4. for ref. Clean installation of windows 10 (by USB memory)

4.1 タブレット中のデバイスドライバーを退避する。これは、デバイスドライバーが簡単に手に入らないことや、デバイスとドライバーの対応付けが難しいことから行う。

'4.1 Save device drivers inside of the tablet PC in backup. This will be helpful for recovery the device drivers,
because it might be difficult that these drivers will be got from another places.

   例: windowsにあるdismコマンドで退避
   e.g. Save them by using windows' 'dism' command.

   mkdir D:\DriversBackup
   dism /online /export-driver /destination:"D:\DriversBackup"

   ※ https://news.mynavi.jp/article/win10tips-137/ の記事を参考にした。

'4.2 windowsをmicrosoftのサイト(*2)の手順通りにツールを使ってクリーンインストールする。なお、この時、購入時と構成が変わっているとproduct keyが必要になったりするので、SDHCカードを入れてあれば、抜いて行う。
(*2) https://www.microsoft.com/ja-jp/software-download/windows10
このツールを使用して、別のPCにwindows 10 をインストールするためにインストールメディアを作成するのところの手順に従う。

'4.2 Clean installation of windows 10 according to the instructions on the microsoft website(*2). You may remove a SDHC card to prevent a mismatch between the original configuration and the current configuration, especially storage configration.
(*2) https://www.microsoft.com/ja-jp/software-download/windows10
follow the part of "Using the tool to create installation media to install Windows 10 on a different PC".

'4.3 windows をインストールし起動後、4.1で退避したドラバーを、デバイスマネージャーからインストールする。 デバイスマネージャーから、エラーになっているデバイスのところをデバイスマネージャーの更新を使ってインストールする。Broadcom 802.11ac WDI SDIO Adapter のところともう一ケ所はエラーになるかも知れない。

'4.3 After restart the installed Windows 10, restore the device drivers from the media that you have saved by 4.1.
Restore the drivers on error marked drivers by the device manager.
You may encouter the error on Broadcom 802.11ac WDI SDIO Adpter and another one error. You can fix these with 3.1 and 3.2

以上は、終わったあと記憶に基づいて記述しているので、細部の表現等で正確でない部分があるかもしれません。 そこは容赦ねがいます。

V-antena and Tanimoto's page

あなたはIPv4でアクセスしています