SQLite で WordPress 6 を新規構築する
WordPress開発コミュニティでは、2022年にバックエンドとして SQLiteを公式サポートする提案 がなされた。現在も対応のための開発が sqlite-database-integration プラグインとして進められている。
この公式プラグインを用いて WordPress 6.6 を 新規に構築する 方法のメモを示す。既存のインストールに対するプラグインの追加ではないので、他のデータベースバックエンドがない環境でも通用するはずだ(例えばさくらのレンタルサーバ ライトプランとか)
dislaimers and notes
- きちんとしたドキュメントを一切参照していない。単純に勘で進めた。というわけで何か間違っている可能性はある
- WordPress がバージョンアップした際に、ときおりデータベース スキーマのアップグレードが必要になる場合がある。この際、 WordPressのアップデータがSQLiteに対応しておらず、スキーマ更新も出来なければWordPress本体バージョンのロールバックもできない状態でスタックする場合がある (かつて経験した)
method
- WordPress 本体の展開
- https://ja.wordpress.org/download/ から latest-ja.zip をダウンロードし、Webサーバの適切なディレクトリにunzipする
- sqlite-database-integration プラグインのダウンロード
- https://ja.wordpress.org/plugins/sqlite-database-integration/ から、ひとまず適当な作業ディレクトリに sqlite-database-integration.zip をダウンロードする
- sqlite-database-integration のインストール
unzip sqlite-database-integration.zip cp -r sqlite-database-integration \ ${wordpress インストールディレクトリ}/wp-content/plugins/ cp -r sqlite-database-integration/wp-includes/sqlite \ ${wordpress インストールディレクトリ}/wp-includes/ cp sqlite-database-integration/db.copy \ ${wordpress インストールディレクトリ}/wp-content/db.php
- wp-config.php の設定
cd ${wordpress インストールディレクトリ} cp wp-config-sample.php wp-config.php edit ${wordpress インストールディレクトリ}/wp-config.php
# 以下のソルトを https://api.wordpress.org/secret-key/1.1/salt/ で生成して置き換え define( 'AUTHKEY', 'put your unique phrase here' ); define( 'SECUREAUTHKEY', 'put your unique phrase here' ); define( 'LOGGEDINKEY', 'put your unique phrase here' ); define( 'NONCEKEY', 'put your unique phrase here' ); define( 'AUTHSALT', 'put your unique phrase here' ); define( 'SECUREAUTHSALT', 'put your unique phrase here' ); define( 'LOGGEDINSALT', 'put your unique phrase here' ); define( 'NONCESALT', 'put your unique phrase here' );
- WordPressのディレクトリを公開し、その公開URLにアクセスすればWordPressのインストーラが表示される
- データベースの設定画面は表示されない(スキップされるはず)。そのままインストールを進めればWordPressがSQLite上で利用可能になる。
- SQLiteのデータベースは
${wordpress インストールディレクトリ}/wp-content/database/.ht.sqlite
に保存されている(このファイルを削除して公開URLにアクセスすれば、再びインストーラが表示される)