• <tfoot id='r5aEw'></tfoot>
    <i id='r5aEw'><tr id='r5aEw'><dt id='r5aEw'><q id='r5aEw'><span id='r5aEw'><b id='r5aEw'><form id='r5aEw'><ins id='r5aEw'></ins><ul id='r5aEw'></ul><sub id='r5aEw'></sub></form><legend id='r5aEw'></legend><bdo id='r5aEw'><pre id='r5aEw'><center id='r5aEw'></center></pre></bdo></b><th id='r5aEw'></th></span></q></dt></tr></i><div id='r5aEw'><tfoot id='r5aEw'></tfoot><dl id='r5aEw'><fieldset id='r5aEw'></fieldset></dl></div>
      <bdo id='r5aEw'></bdo><ul id='r5aEw'></ul>
    1. <small id='r5aEw'></small><noframes id='r5aEw'>

      <legend id='r5aEw'><style id='r5aEw'><dir id='r5aEw'><q id='r5aEw'></q></dir></style></legend>

        无法在 CentOS 7 上的 PHP 中打开 file_put_contents 上的流

        时间:2024-04-13
          <tbody id='0zg4U'></tbody>

      1. <small id='0zg4U'></small><noframes id='0zg4U'>

        • <bdo id='0zg4U'></bdo><ul id='0zg4U'></ul>

            <tfoot id='0zg4U'></tfoot>

                <legend id='0zg4U'><style id='0zg4U'><dir id='0zg4U'><q id='0zg4U'></q></dir></style></legend>
                <i id='0zg4U'><tr id='0zg4U'><dt id='0zg4U'><q id='0zg4U'><span id='0zg4U'><b id='0zg4U'><form id='0zg4U'><ins id='0zg4U'></ins><ul id='0zg4U'></ul><sub id='0zg4U'></sub></form><legend id='0zg4U'></legend><bdo id='0zg4U'><pre id='0zg4U'><center id='0zg4U'></center></pre></bdo></b><th id='0zg4U'></th></span></q></dt></tr></i><div id='0zg4U'><tfoot id='0zg4U'></tfoot><dl id='0zg4U'><fieldset id='0zg4U'></fieldset></dl></div>
                • 本文介绍了无法在 CentOS 7 上的 PHP 中打开 file_put_contents 上的流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道这是一个有很多线程的常见错误,但我厌倦了搜索,但我仍然没有解决它.当我尝试运行函数 file_put_contents 时,我收到以下错误:

                  I know this is a common bug with many threads but I'm tired of searching and I still haven't solved it. When I try to run the function file_put_contents I get the following error:

                  Warning: file_put_contents(test.txt): failed to open stream: Permission denied in /var/www/html/nurses/adminWriter.php on line 29
                  

                  我已经做了最常见的回答,把nurses文件夹和test.txt文件的权限改成777.那个不行.

                  I've already done the most common answer, change the permissions of the nurses folder and the test.txt file to 777. That didn't work.

                  我目前正在全新安装最新的 CentOS 7 服务器.

                  I'm currently on a fresh install of the latest CentOS 7 server.

                  我发现如果我通过控制台运行php脚本:

                  I've found that if I run the php script through the console:

                  # php /var/www/html/nurses/adminWriter.php
                  

                  它工作得很好,我只有在通过浏览器运行它时才会得到错误,但我真的需要这样运行它.

                  It works just fine, I get the error only when running it through the browser, but I really need to run it this way.

                  最好的问候!

                  推荐答案

                  好的,我找到了问题:selinux

                  Ok, I found the issue: selinux

                  解决方案如下:http://kb.sp.parallels.com/en/11142

                  万一页面宕机:

                  症状

                  在您更改存储网站内容的默认目录(例如,更改为/home")后,您将无法通过 Web 访问子域和其他网站的内容.

                  After you change the default directory to store website content (say, to "/home"), you are unable to access the content of subdomains and additional websites over the Web.

                  原因

                  如果SELinuxEnforcement"模式下工作,则会出现此问题.在这种模式下,网站的 webroot 目录和其中的子域具有不同的权限,您的 Web 服务器无法访问它们.运行这个命令:

                  This problem occurs if SELinux works in "Enforcement" mode. In this mode, webroot directories for websites and subdomains inside them have different permissions, and your web server fails to access them. Run this command:

                  # getenforce
                  

                  输出应该是:Enforcing

                  分辨率

                  禁用SELinux支持:在任意编辑器中打开文件/etc/selinux/config并找到这一行:

                  Disable SELinux support: Open the file /etc/selinux/config in any editor and find this row:

                  SELINUX=<value>
                  

                  改成:

                  SELINUX=disabled
                  

                  如果找不到此文件,请在任意编辑器中打开文件/boot/grub/grub.conf 并将参数 selinux=0 添加到 Grub Boot Loader:

                  If you cannot find this file, open the file /boot/grub/grub.conf in any editor and add the parameter selinux=0 to the Grub Boot Loader:

                  title SE-Linux Test System
                  root (hd0,0)
                  kernel /boot/vmlinuz-2.4.20-selinux-XXXXXXXXXX ro root=/dev/hda1 nousb selinux=0
                  #initrd /boot/initrd-2.4.20-selinux-XXXXXXXXXX.img
                  

                  重新启动服务器以应用更改.如果您不想重新启动,请运行以下命令:

                  Reboot the server to apply the changes. If you do not want to reboot, run this command:

                  # setenforce 0
                  

                  这篇关于无法在 CentOS 7 上的 PHP 中打开 file_put_contents 上的流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:“流或文件"laravel.log"无法打开:无法打开流:权限被拒绝" 下一篇:如何在 CentOS 中为 PHP 5 添加 curl 支持

                  相关文章

                    <tfoot id='D6Mz5'></tfoot>

                    <small id='D6Mz5'></small><noframes id='D6Mz5'>

                    1. <i id='D6Mz5'><tr id='D6Mz5'><dt id='D6Mz5'><q id='D6Mz5'><span id='D6Mz5'><b id='D6Mz5'><form id='D6Mz5'><ins id='D6Mz5'></ins><ul id='D6Mz5'></ul><sub id='D6Mz5'></sub></form><legend id='D6Mz5'></legend><bdo id='D6Mz5'><pre id='D6Mz5'><center id='D6Mz5'></center></pre></bdo></b><th id='D6Mz5'></th></span></q></dt></tr></i><div id='D6Mz5'><tfoot id='D6Mz5'></tfoot><dl id='D6Mz5'><fieldset id='D6Mz5'></fieldset></dl></div>
                      • <bdo id='D6Mz5'></bdo><ul id='D6Mz5'></ul>
                    2. <legend id='D6Mz5'><style id='D6Mz5'><dir id='D6Mz5'><q id='D6Mz5'></q></dir></style></legend>