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

    <tfoot id='I9giO'></tfoot>

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

      file_put_contents 未创建 txt 文件

      file_put_contents not creating txt file(file_put_contents 未创建 txt 文件)
        <tbody id='neFPf'></tbody>
    2. <legend id='neFPf'><style id='neFPf'><dir id='neFPf'><q id='neFPf'></q></dir></style></legend>

            <i id='neFPf'><tr id='neFPf'><dt id='neFPf'><q id='neFPf'><span id='neFPf'><b id='neFPf'><form id='neFPf'><ins id='neFPf'></ins><ul id='neFPf'></ul><sub id='neFPf'></sub></form><legend id='neFPf'></legend><bdo id='neFPf'><pre id='neFPf'><center id='neFPf'></center></pre></bdo></b><th id='neFPf'></th></span></q></dt></tr></i><div id='neFPf'><tfoot id='neFPf'></tfoot><dl id='neFPf'><fieldset id='neFPf'></fieldset></dl></div>
              <bdo id='neFPf'></bdo><ul id='neFPf'></ul>

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

            • <tfoot id='neFPf'></tfoot>
              1. 本文介绍了file_put_contents 未创建 txt 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我目前有一个 php 脚本,它在浏览器浏览器浏览网页时运行.我要做的是在脚本运行时编写一个文本文件来存储变量.该文件夹的所有者是apache,但每个人都有读写权限,严格用于测试目的.(我认为这可能是权限问题)在服务器上启用了 SELINUX,当我从控制台运行脚本时,它会在正确的目录中创建文本文件.

                I currently have a php script that is running when a browser browser browses to the webpage. What I'm trying to do is write a text file when the script runs that stores a variable. The owner of the folder is apache, but everyone has read write, strictly for testing purposes. (I thought it might be a permissions issue) SELINUX is enabled on the server, and when I run the script from console it creates the text file just fine, and in the right directory.

                file_put_contents("My working file location", $myString);
                

                我正在使用这一行来尝试编写和创建文本文件,我知道我的文件位置有效,因为我可以运行它并在离线模式下创建它,即通过控制台运行它.问题是我试图写入的变量是通过 HTTP Post 填充的,当我通过浏览器运行脚本时,或者当 apache 运行脚本时,它不会写入或创建文件.我需要做些什么来允许访问写入/更改语法明智地让这个脚本写入这个文本文件?

                I'm using this line to try to write and create the text file, I know that my file location works becaus I can run it and create it in offline mode, I.E. running it through console. The problem is that the variable I'm trying to write is populated through HTTP Post, and when I run the script through the browser, or when apache runs the script, it does not write or create the file. What do I need to do to allow access to write/change syntax wise to get this script to write this text file?

                推荐答案

                您的问题可能是由于 apache 没有权限写入您指定的文件位置.转到该目录并使用 ls 命令检查权限和组所有权:

                Your problem is likely due to apache not having permissions to write to the file location you specified. Go to that directory and check the permissions and group ownership with the ls command:

                cd "My working file location"
                ls -l .
                

                输出中有三列显示目录的权限、所有者和组.它们很可能归 root 所有,并且没有 apache 写入目录的权限.

                There are three columns in the output that show the permissions, owner, and group for the directory. Most likely they are owned by root and don't have permissions for apache to write to the directory.

                如果是这种情况,那么当 apache 尝试创建文件时,您会在 apache 日志中看到一个错误.在浏览器中运行脚本时尝试跟踪日志:

                If this is the case, then you will see an error appear in your apache log when it tries to create the file. Try tailing your logs while running the script in your browser:

                tail -f /var/log/apache2/error.log
                

                这篇关于file_put_contents 未创建 txt 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                  <i id='5xaxu'><tr id='5xaxu'><dt id='5xaxu'><q id='5xaxu'><span id='5xaxu'><b id='5xaxu'><form id='5xaxu'><ins id='5xaxu'></ins><ul id='5xaxu'></ul><sub id='5xaxu'></sub></form><legend id='5xaxu'></legend><bdo id='5xaxu'><pre id='5xaxu'><center id='5xaxu'></center></pre></bdo></b><th id='5xaxu'></th></span></q></dt></tr></i><div id='5xaxu'><tfoot id='5xaxu'></tfoot><dl id='5xaxu'><fieldset id='5xaxu'></fieldset></dl></div>

                      <bdo id='5xaxu'></bdo><ul id='5xaxu'></ul>

                      <small id='5xaxu'></small><noframes id='5xaxu'>

                      • <legend id='5xaxu'><style id='5xaxu'><dir id='5xaxu'><q id='5xaxu'></q></dir></style></legend>

                            <tbody id='5xaxu'></tbody>
                          <tfoot id='5xaxu'></tfoot>