LoginSignup
0
0

More than 3 years have passed since last update.

Wordpressの「予期しないエラー」でテーマが選べない場合の対処法

Last updated at Posted at 2020-11-26

環境

CentOS8、MariaDB 10.3.17、PHP 7.4.13、apache 2.4.37、SELINUX=enforcing

問題

Wordpressのテーマを変更しようとして、「新規追加」ボタンを押すと、エラーが出てテーマを選択できない。
image.png

原因

そもそも自分が操作しているクライアントPCとは繋がっており、ファイアーウォールとかではない。ということでSELinuxのログを見るとdeniedの文字が大量に出てる。

# aureport --avc

AVC Report
===============================================================
# date time comm subj syscall class permission obj result event
===============================================================
1. 11/25/2020 19:00:36 ? system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 0 (null) (null) (null) unset 141
2. 11/25/2020 19:34:17 php-fpm system_u:system_r:httpd_t:s0 0 tcp_socket name_connect system_u:object_r:http_port_t:s0 denied 226
...

RedHatのドキュメントによると、SELinuxをdisableにしていない場合、SELinuxはApacheが外部ネットワークと通信するのを許可しない。なので、テーマだけでなくプラグインの追加とか、外部ネットワークとの通信が発生する処理なら全て同じエラーが発生する。

4.4.2. Security-Enhanced Linux
This reference environment has been set up and tested with Security-Enhanced Linux (SELinux) enabled in ENFORCING mode. Once again, please refer to the Red Hat documentation on SELinux for further details on using and configuring this feature. For any other operating system, consult the respective documentation for security and firewall solutions to ensure that maximum security is maintained while the ports required by your application are opened.

When enabled in ENFORCING mode, by default, SELinux prevents Apache web server from establishing network connections. On the machine hosting Apache web server, configure SELinux it to allow httpd network connections:

# /usr/sbin/setsebool httpd_can_network_connect 1

対処法

ということで、上記のコマンドでSELinuxにApacheの外部ネットワークとの通信を許可させる。
めでたく解決。
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0