PHP未在与Apache相同的用户下运行
我在本地机器上安装了Wordpress。然而,要安装插件,它总是要求我提供FTP凭据。有。下面是我所做的: 我转到文件PHP未在与Apache相同的用户下运行,php,wordpress,apache,debian,Php,Wordpress,Apache,Debian,我在本地机器上安装了Wordpress。然而,要安装插件,它总是要求我提供FTP凭据。有。下面是我所做的: 我转到文件wp admin/includes/file.php,并注释了取消链接行,以便临时文件不会被删除。然后我检查了该文件的权限,它们是-rw-r--r--www-data www-data。这很好,因为我希望Apache服务器作为www-data:www-data运行 但是,我var\u dump'edgetmyuid()和@fileowner($temp\u file\u name
wp admin/includes/file.php
,并注释了取消链接
行,以便临时文件不会被删除。然后我检查了该文件的权限,它们是-rw-r--r--www-data www-data
。这很好,因为我希望Apache服务器作为www-data:www-data
运行
但是,我var\u dump
'edgetmyuid()
和@fileowner($temp\u file\u name)
。我得到的结果是1000
(xedinunknown
)和33
(www-data
)。这意味着,当Apache作为www-data
运行时,PHP作为xedinunknown
运行(如果我错了,请纠正我)。问题是:为什么会这样
我已经安装了suEXEC,但被禁用了,看起来我正在将PHP作为Apache模块运行(etc/apache2/mods available/php5.load
有以下条目:LoadModule php5_module/usr/lib/apache2/modules/libphp5.so
)
简单回顾一下,我正在Debian7.164位上运行PHP5.5.4/Apache2.4.6
现在,我更改了Apache的envvars
以xedinunknown:www-data运行,chown
打开锁目录,然后重新启动。这允许我安装插件,但我想这只是一个临时措施
更新
好吧,很公平。下面是apache2ctl-t-D转储模块的输出:
core_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
dav_module (shared)
dav_fs_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
fcgid_module (shared)
include_module (shared)
mime_module (shared)
negotiation_module (shared)
php5_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
status_module (shared)
在OSX上,我使用了以下方法,并且效果良好:
sudo chown -R _www:_www {path to wordpress folder}
_www是PHP在Mac上运行的用户。(您可以将其更改为PHP安装在特定操作系统上运行的任何内容)
(您可能还需要chmod一些文件夹。我先这么做了,但它没有修复。直到我执行chown命令,它才起作用,所以我不确定它是单独使用chown命令,还是chmod和chown的组合。)看起来您可以像快速运行支持cgidded的模块一样运行php。有没有办法确定哪个处理程序是用户?另外,是否有一种方法可以正确配置权限,使所有内容都能与CGI/FCGI一起工作?什么决定了PHP最终运行的用户?