【不具合内容】
Google Cloud Platformに引越し後に発生。大抵は権限がないために発生しているエラー。index.phpの先頭に下記を追加してF5を押して再読込。エラーを確認してみる。
ini_set( ‘display_errors’, 1 );
ini_set( ‘error_reporting’, E_ALL );
<?php /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * for debug */ ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define( 'WP_USE_THEMES', true ); /** Loads the WordPress Environment and Template */ require( dirname( __FILE__ ) . '/wp-blog-header.php' );
【原因】
確認したエラーは以下。「Permission denied」が出ているので権限エラーであることを確認。
Warning: require_once(wp-config.php): failed to open stream: Permission denied in /opt/bitnami/apps/wordpress/htdocs/wp-load.php on line 37
【解決方法】
以下コマンドでオーナーと権限を設定する。755や664は少し気になるがGCPでbitnamiを使用した環境では普通らしい。
sudo chown -R bitnami:deamon /opt/bitnami/apps/wordpress/htdocs/
sudo find /opt/bitnami/apps/wordpress/htdocs/ -type d -exec chmod 755 {} \;
sudo find /opt/bitnami/apps/wordpress/htdocs/ -type f -exec chmod 664 {} \;