LoginSignup
0
0

More than 1 year has passed since last update.

Wordpressの更新で「ファイルをコピーできませんでした。」エラーが出る原因

Posted at

発端

WordPressの更新で「ファイルをコピーできませんでした。」というエラーが出たので、オーナーかパーミッションだろうと高をくくって色々していたんですが一向にエラーが消えなくて小一時間ハマった話です。
wp_error_01.png

環境

CentOS7 + PHP7.4 + nginx + php-fpm

原因

何回もオーナーやパーミッションを変更してちょっと疲れ始めたときに、そもそもここで動いているPHPってちゃんとnginxオーナーで動いてるのか?と疑問を持ちました。

nginxのオーナー

/etc/nginx/nginx.conf
user  nginx;
worker_processes  auto;

大丈夫ですね。

で、今回はPHPはPHP-FPMが動いているのでphp-fpmの方も見ます。

/etc/php-fpm.d/www.conf
  ~中略~
; RPM: apache user chosen to provide access to the same directories as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache

apacheやん!! nginx+php-fpmなのにapache・・・ダメダメでしたorz

ということでnginxに修正します。

/etc/php-fpm.d/www.conf
  ~中略~
; RPM: apache user chosen to provide access to the same directories as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

そしてphp-fpmを再起動

# systemctl restart php-fpm
#

そして再度プラグインを更新
wp_ok_01.png

やっと更新できた・・・。

久しぶりに触ってコロッと忘れていたんですが、このサイトは元々Apacheで動いていたものを移植したのでした。
そのことが頭からすっぽり抜けてしまっていたのでこんなことになったという顛末でした・・。

しょーもない原因でハマったのですが、また忘れそうなので備忘として書いておきます。

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