php - 在 stderr 中发送的 FastCGI:“PHP 消息:PHP 警告:mkdir():只读文件系统
问题描述
我正在nginx 1.16.1
运行php 7.4.0
。Manjaro KDE 18.1.4
我在 pure 上有一个非常相似的设置,arch Linux arm
其中以下设置运行没有问题。
我尝试设置一个 yii2 项目,输入时显示以下错误ig-net.at
:
该目录不可被 Web 进程写入
或者
创建目录“/usr/share/nginx/html/ig-net/runtime”失败:mkdir():只读文件系统
nginx 错误日志显示以下错误:
在标准错误中发送的 FastCGI:“PHP 消息:PHP 警告:mkdir():只读
网站所在的html文件夹位于/usr/share/nginx/html/
并相应地更改了权限
chmod -R g+w /usr/share/nginx/html/
chgrp -R http /usr/share/nginx/html/
chown -R http /usr/share/nginx/html/
nginx 和 php-fpm 的两个进程都与http
用户一起运行。
ps aux | grep nginx
并ps aux | grep php-fpm
返回以下内容:
root 6294 0.0 0.0 11868 1252 ? Ss 15:33 0:00 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; error_log stderr;
http 6295 0.0 0.0 12496 4352 ? S 15:33 0:00 nginx: worker process
root 3393 0.0 0.3 88140 26844 ? Ss 14:15 0:00 php-fpm: master process (/etc/php/php-fpm.conf)
http 3395 0.0 0.2 92988 19512 ? S 14:15 0:00 php-fpm: pool www
http 3396 0.0 0.2 92988 19776 ? S 14:15 0:01 php-fpm: pool www
nginx 配置文件看起来像这样
user http;
worker_processes 1;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite /.* /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_read_timeout 180;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80;
listen [::]:80;
server_name ig-net.at;
root /usr/share/nginx/html/ig-net/web;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite /.* /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_read_timeout 180;
}
}
}
我还尝试在终端中与http
用户一起创建一个文件夹,它可以正常工作。
那么 Web 进程无法正常工作的问题是什么?
谢谢, 卢克
解决方案
我猜为什么用户http
只写/srv/http
是因为它是用户的默认主目录。
看:
# grep http /etc/passwd
http:x:33:33::/srv/http:/usr/bin/nologin
推荐阅读
- npm - 运行 npm install 时出错
- maven - Intellij 在实际没有错误时报告依赖错误
- c# - Xamarin 插件地理定位器不适用于 Xamarin Forms android
- algorithm - 给定一个包含两个整数作为节点的查询,在树中找到这两个节点的所有子节点?
- spring - 使用spring boot默认杰克逊映射时日期时区发生变化
- html - 使用 inline-block 时 div 消失
- app-engine-ndb - 设置 NDB 模型对象的 is_saved 属性未按预期工作
- tortoisehg - 在 Windows 中使用 TortoiseHg 复制和重命名
- dns - 如何从 .onmicrosoft.com 域中删除两条 TXT 记录
- node.js - Nodejs错误:ENOENT:没有这样的文件或目录,stat