PHP Codeigniter-ftp_nlist():无法创建临时文件。检查临时文件目录中的权限 [英] PHP Codeigniter - ftp_nlist(): Unable to create temporary file. Check permissions in temporary files directory

查看:182
本文介绍了PHP Codeigniter-ftp_nlist():无法创建临时文件。检查临时文件目录中的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试显示来自FTP服务器的文件。但是在此之前,我要检查文件夹位置是否存在。如果没有,我将创建此目录。我能够创建一个文件夹,但是在我的页面中,发生错误。

I'm trying to display the files from my FTP server. But before that I'm checking if the folder location exists. If not, I'll create this directory. I was able to create a folder but in my page, an error occur.


遇到PHP错误

A PHP Error was encountered

严重性:警告

消息:ftp_nlist():无法创建临时文件。在临时文件目录中检查权限。

Message: ftp_nlist(): Unable to create temporary file. Check permissions in temporary files directory.

文件名:libraries / Ftp.php

Filename: libraries/Ftp.php

行号:551

回溯:

文件:/ Applications / XAMPP / xamppfiles / htdocs / mr-janus / application / controllers / Pages .php
行:41
功能:list_files

File: /Applications/XAMPP/xamppfiles/htdocs/mr-janus/application/controllers/Pages.php Line: 41 Function: list_files

文件:/Applications/XAMPP/xamppfiles/htdocs/mr-janus/index.php
行:315
功能:require_once

File: /Applications/XAMPP/xamppfiles/htdocs/mr-janus/index.php Line: 315 Function: require_once

这是我的代码块:

$data['category'] = $this->uri->segment(2);

$config['hostname'] = 'myftp.server.com';
$config['username'] = 'username';
$config['password'] = 'password';
$path = '/files/' . $data['category'] . '/';
$connected = $this->ftp->connect($config);

if($connected){

  $files = $this->ftp->list_files($path);
  if($files == FALSE){
    $this->ftp->mkdir($path, 0777);
    $files = $this->ftp->list_files($path);
    $this->ftp->chmod('/public_html/foo/bar/', 0775);
    $this->ftp->close();
  }

}


推荐答案


无法创建临时文件。检查临时文件目录中的权限。

Unable to create temporary file. Check permissions in temporary files directory.

这意味着PHP临时目录不存在或运行PHP的本地帐户没有写入权限

That means PHP temporary directory does not exist or the local account that runs PHP does not have a write access to the directory.

临时目录由 php.ini 中的 sys_temp_dir 指令。

如果未设置指令,PHP将退回到系统临时文件夹。

If the directive is not set, PHP will fall back to system temporary folder.

基本上,您的问题与无关您的FTP代码,但使用您的PHP配置。

Basically, your problem has nothing to do with your FTP code, but with your PHP configuration.

这篇关于PHP Codeigniter-ftp_nlist():无法创建临时文件。检查临时文件目录中的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆