无法启动php,因为它无法创建PID文件
如果我尝试启动PHP-FPM,则会出现以下错误: 错误:无法创建PID文件(/var/run/php fpm/php fpm.PID)。:没有这样的文件或目录 错误:FPM初始化失败 我是否必须在无法启动php,因为它无法创建PID文件,php,systemd,Php,Systemd,如果我尝试启动PHP-FPM,则会出现以下错误: 错误:无法创建PID文件(/var/run/php fpm/php fpm.PID)。:没有这样的文件或目录 错误:FPM初始化失败 我是否必须在systemctl.service文件中授予权限,以便它可以创建文件夹和文件 这是我的php.service文件: [Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Servic
systemctl
.service
文件中授予权限,以便它可以创建文件夹和文件
这是我的php.service
文件:
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=notify
EnvironmentFile=/etc/opt/remi/php70/sysconfig/php-fpm
ExecStart=/opt/remi/php70/root/usr/sbin/php-fpm --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
在www.conf
文件中,有一个用户和组被设置为apache
。我尝试将其更改为root
,但随后收到消息“尝试root以外的其他用户”。我也尝试过nginx,但还是出现了之前的错误
这是我的www.conf
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or @php_fpm_prefix@) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
; Set listen(2) backlog.
; Default Value: 511
;listen.backlog = 511
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server.
; Default Values: user and group are set as the running user
; mode is set to 0660
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users = apache,nginx
;listen.acl_groups =
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
"www.conf" 422L, 18812C
编辑:我缺少
/var/run/php fpm/
文件夹。我已经添加了它,现在它运行了。当您运行php服务时,该文件将自动创建
RUN service php7.0-fpm start
错误:无法创建PID文件(/var/run/php fpm/php fpm.PID)。:没有这样的文件或目录
这意味着目录/var/run/php fpm/
不存在。您应该将此目录添加到配置中。例如,将以下行添加到/usr/lib/tmpfiles.d/php fpm.conf
:
d /var/run/php-fpm 755 root root
在php.Service
文件的[Service]
部分中设置PIDFile
:
PIDFile=/var/run/php-fpm/php-fpm.pid
重新安装并启动服务:
systemctl disable php.service
systemctl enable php.service
systemctl start php.service
你能包括你的配置吗?我已经在我的帖子中编辑了.service文件以及www.conf文件的用户和组,或者你指的是哪个配置?@Barsch,尝试将
PIDFile=/var/run/php fpm/php fpm.pid
添加到[service]
section@RuslanOsmanov我试过了。还是一样的错误。在/var/run/中没有php fpm文件夹。但是我想它应该在php的开始/安装时创建?添加了这个文件夹,现在它开始了。我收到以下消息:Job for php70-php-fpm.service失败,因为控制进程退出时出现错误代码。有关详细信息,请参阅“systemctl status php70 php fpm.service”和“journalctl-xe”。
您使用哪个php版本?我在这台服务器上使用php7尝试将php56 php fpm
和php fpm
添加到变量php\u包
noob问题:我如何做到这一点,它做了什么?