
令和6年2月8日
MySQLがないならSQLite(wp-sqlite-db)を使う
使っているレンタルサーバーの最安プランにはMySQLがなかった。
アップデートを機に令和6年2月8日時点で通用する情報を記録。
参考にしたページ(非常に詳しい)
レンタルサーバーではMySQLの制限がありワードプレスの利用を諦めている方はいませんか?それを救うのがsqliteです。その方法を解説します。
WordPressでSqliteが使えない理由と対応策 ー 辛口くるま評価の査定君
公式による説明
公式ページにはインストールまでの方法が簡潔に記されている。
About
A single file drop-in for using a SQLite database with WordPress. Based on the original SQLite Integration plugin.(訳)
wp-sqlite-db公式ページ より
About
WordPress で SQLite データベースを使用するための単一ファイル ドロップイン。オリジナルの SQLite 統合プラグインに基づいています。
手に入れる
wp-sqlite-db公式ページの右側にあるReleasesより書庫を手に入れる。
現在の最新版はFeb 6, 2023 v1.3.1となっている。
インストールする
書庫から手に入れたsrc/db.phpをwp-contentへ移す。
wp-config-sample.phpの一部を変更する。
/**#@+
- Authentication unique keys and salts.
*- Change these to different unique phrases! You can generate these using
- the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*- You can change these at any point in time to invalidate all existing cookies.
- This will force all users to have to log in again.
*- @since 2.6.0
*/
define( ‘AUTH_KEY’, ‘put your unique phrase here’ );
define( ‘SECURE_AUTH_KEY’, ‘put your unique phrase here’ );
define( ‘LOGGED_IN_KEY’, ‘put your unique phrase here’ );
define( ‘NONCE_KEY’, ‘put your unique phrase here’ );
define( ‘AUTH_SALT’, ‘put your unique phrase here’ );
define( ‘SECURE_AUTH_SALT’, ‘put your unique phrase here’ );
define( ‘LOGGED_IN_SALT’, ‘put your unique phrase here’ );
define( ‘NONCE_SALT’, ‘put your unique phrase here’ );/*#@-/
wp-config-sample.php より
WordPress.org secret-key serviceを利用し、以下のような文字列を手に入れる。
これを先ほどのwp-config-sample.php内の該当部分と置き換える。
置き換え後、wp-config-sample.phpをwp-config.phpへ改める。
あいまい
前回やったときはdb.phpを移動したのは一番最後だったような気もする。
リモートで作業してたし、古い情報を元に試行錯誤しつつconfigだけは先に作っていたかもしれないので。
なのでキーとdb.phpの先後の関係がよくわからない。
MySQLがないせいでデータベースエラーが出ての作業という記憶はあるが。
アップデートについて
令和6年2月7日
作業内容:db.phpをv1.2.1よりv1.3.0へアップデート(db.phpの上書き)
状況:今のところ特に何もなし
令和6年2月12日 追記
状況:アップデートから2~3日して重大なエラーの発生(管理画面も出ず)
処置:Broken Link Checker関係のプラグインの無効化
詳細:db.phpアップデートの関係かと思いきや他のプラグインの関係であった(通知もなく詳細は不明)