儘管檔案權限正確,Wordpress 仍無法寫入檔案

儘管檔案權限正確,Wordpress 仍無法寫入檔案

我無法在新的 WordPress 設定上自動安裝外掛或主題。它給了我這個螢幕:

在此輸入影像描述

我相信這通常是由於 wordpress 目錄的寫入權限錯誤造成的。這些是我到目前為止已完成的步驟:

nginx 在 root 使用者下執行,工作進程在 nginx 使用者下:

# ps -ef | grep nginx | head
root     14197     1  0 07:46 ?        00:00:00 nginx: master process nginx
nginx    14198 14197  0 07:46 ?        00:00:00 nginx: worker process

PHP-FPM 在 root 使用者下執行,工作進程在 nginx 使用者下:

# ps -ef | grep php-fpm | head
root     14748     1  0 08:38 ?        00:00:00 php-fpm: master process (/etc/php-fpm.conf)
nginx    14749 14748  0 08:38 ?        00:00:00 php-fpm: pool www
nginx    14750 14748  0 08:38 ?        00:00:00 php-fpm: pool www
nginx    14751 14748  0 08:38 ?        00:00:00 php-fpm: pool www
nginx    14752 14748  0 08:38 ?        00:00:00 php-fpm: pool www
...

root 使用者是 nginx 群組的一部分:

# groups root
root : root nginx

wordpress 目錄由 nginx:nginx 和 777 所有(均為遞迴):

# ls -l /var/www/
total 4
drwxrwxrwx. 5 nginx nginx 4096 Feb 24 06:45 wordpress

但這都不能解決問題。我不確定接下來要檢查什麼。我使用的是 centOS 7 最低版本。

答案1

您可以將以下行新增至 wp-config.php 檔案中以直接寫入檔案系統:

define('FS_METHOD','direct');

相關內容