0 レビュー
0 回答
php-WordpressプラグインがGoogleAppEngineでエラーを自動ロード-一部のクラスがロードされない
php74ランタイムのGAE標準環境でいくつかのWPプラグインに問題があります。次のようなエラーが発生し続けます:
Fatal error: Uncaught Error: Class 'enshrined\svgSanitize\data\AllowedAttributes' not found in /workspace/wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/src/Sanitizer.php:87
Stack trace:
#0 /workspace/wp-content/plugins/svg-support/svg-support.php(36): enshrined\svgSanitize\Sanitizer->__construct()
#1 /workspace/wp-admin/includes/plugin.php(2288): include_once('/workspace/wp-c...')
#2 /workspace/wp-admin/plugins.php(192): plugin_sandbox_scrape('svg-support/svg...')
#3 /workspace/gae-app.php(63): require('/workspace/wp-a...')
#4 {main}
thrown in /workspace/wp-content/plugins/svg-support/vendor/enshrined/svg-sanitize/src/Sanitizer.php on line 87
vendor
サブディレクトリがアップロードされ、クラスが欠落しているファイルがそこにあります(GCPデバッガーでデプロイされたアプリのファイルリストを確認しました)。
これは自動読み込みと関係があると思いますが、Wordpressとプラグインに関する情報は見つかりませんでした。
私のapp.yml
ファイル:
# App Engine runtime configuration
runtime: php74
service: default
# Defaults to "serve index.php" and "serve public/index.php". Can be used to
# serve a custom PHP front controller (e.g. "serve backend/index.php") or to
# run a long-running PHP script as a worker process (e.g. "php worker.php").
entrypoint: serve gae-app.php
# Defines static handlers to serve WordPress assets
handlers:
- url: /(.*\.(htm|html|css|js))
static_files: \1
upload: .*\.(htm|html|css|js)$
- url: /wp-content/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
static_files: wp-content/\1
upload: wp-content/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
- url: /(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
static_files: \1
upload: .*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
- url: /wp-includes/images/media/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))
static_files: wp-includes/images/media/\1
upload: wp-includes/images/media/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
gae-app.php
は、リポジトリのgoogleサンプル Wordpress on GAE standard environment
から取得しました:
<?php
/**
* This file handles all routing for a WordPress project running on App Engine.
* It serves up the appropriate PHP file depending on the request URI.
*
* @see https://cloud.google.com/appengine/docs/standard/php7/runtime#application_startup
*/
/**
* Function to return a PHP file to load based on the request URI.
*
* @param string $full_request_uri The request URI derivded from $_SERVER['REQUEST_URI'].
*/
function get_real_file_to_load($full_request_uri)
{
$request_uri = @parse_url($full_request_uri)['path'];
// Redirect /wp-admin to /wp-admin/ (adds a trailing slash)
if ($request_uri === '/wp-admin') {
header('Location: /wp-admin/');
exit;
}
// Serve up "index.php" when /wp-admin/ is requested
if ($request_uri === '/wp-admin/') {
return '/wp-admin/index.php';
}
// Load the file requested if it exists
if (is_file(__DIR__ . $request_uri)) {
return $request_uri;
}
// Send everything else through index.php
return '/index.php';
}
// fixes b/111391534
$_SERVER['HTTPS'] = $_SERVER['HTTP_X_APPENGINE_HTTPS'];
// Loads the expected WordPress framework file
// (e.g index.php, wp-admin/* or wp-login.php)
$file = get_real_file_to_load($_SERVER['REQUEST_URI']);
// Set the environment variables to reflect the script we're loading
// (in order to trick WordPress)
$_SERVER['DOCUMENT_URI'] = $_ENV['DOCUMENT_URI'] = $file;
$_SERVER['PHP_SELF'] = $_ENV['PHP_SELF'] = $file;
$_SERVER['SCRIPT_NAME'] = $_ENV['SCRIPT_NAME'] = $file;
$_SERVER['SCRIPT_FILENAME'] = $_ENV['SCRIPT_FILENAME'] = __DIR__ . $file;
require __DIR__ . $file;
[編集]影響を受けていることがわかったプラグイン:
svg-support
、 wordfence
、 post-smtp
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。