Joomla 3.4.3 - configuration.php 不可写

Joomla 3.4.3 - configuration.php not writable

使用 MariaDB、Apache、PHP5.4.x、RHEL 7

如何允许写入 configuration.php?

安装了几次 Joomla,总是以 configuration.php 文件不可写而告终。我继续,复制配置内容并创建一个新的 php 文件,将它放在 Joomla 所在的位置,打开权限,更改为 apache:apache,仍然没有。我参考了几篇文章,尤其是这篇文章: Installing Joomla 3 Error: Your configuration file or directory is not writable

我也试过创建一个空的 configuration.php 文件并将其放在 joomla 根目录中,打开权限 - 没有用。

我当前的安装状态是 configuration.php 文件就位,但无法通过网络安装程序删除安装目录(假设是因为我硬塞配置文件到位但仍然不可写)。

我尝试了几种权限设置,然后尝试删除安装目录但没有成功。通过 rm -r 手动删除安装目录只会产生一个完全无法访问的站点,迫使我擦除我的 joomla 文件、数据库并重新安装。提前致谢。

我要做的第一件事是检查 php 在您的服务器上运行的用户,并将其与您的站点文件的所有权进行比较。

使用

在您域的根目录创建 user.php 文件
<?php echo exec('whoami'); ?>   

然后用你的兄弟打开那个文件。这将为您提供 php 在您的服务器上运行的用户名。它可能是 apache,但也可能不是。

将此用户与 config.php 的所有权以及您的整个站点安装进行比较。

如果您通过 SFTP 上传新的 Joomla 站点并遵循标准的浏览器安装步骤,权限应该不是问题。如果您要上传 zip 文件并使用终端连接和 SSH,请确保您的 SSH 连接与服务器上的 php 用户是同一用户。

祝你好运!

与我的服务器人员一起工作 - 发现有几个 sebool 设置阻止 Apache 执行它需要执行的操作。更进一步,我们发现 sebool 命令需要 运行 allow httpd_can_sendmail 才能使用 Sendmail 功能。希望这可以帮助那里的人。

似乎可以解决问题的命令是 sudo chcon -R -t httpd_sys_rw_content_t /var/www/html

在我们的案例中,问题出在 CentOS 权限上。因此,如果 Joomla 安装在 CentOS 驱动的服务器上,您需要将配置文件 (/etc/selinux/config) 更改为如下所示:

[root@host2a ~]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0

其实你只是将SELINUX设置为permissive

希望对您有所帮助。

p.s。解决方案也适用于 RedHat。