简体   繁体   English

上传文件返回“缺少临时文件夹”

[英]Upload file returning “Missing a temporary folder”

I have my site hosted on GoDaddy and on that site I have a part for uploads, it worked fine until days ago, now it started to return error 6 - Missing a temporary folder for any file I try to upload, I tried several ways to solve it, changing the php.ini and still nothing.我的网站托管在 GoDaddy 上,在该网站上我有一个上传部分,直到几天前它都运行良好,现在它开始返回错误 6 - 我尝试上传的任何文件都缺少一个临时文件夹,我尝试了几种方法解决它,更改php.ini,仍然没有。

In my PHP file if I use the command file_exists(sys_get_temp_dir());在我的 PHP 文件中,如果我使用命令file_exists(sys_get_temp_dir()); returns me true, so the folder is there.返回 true,所以文件夹在那里。

If I use the is_writable(sys_get_temp_dir());如果我使用is_writable(sys_get_temp_dir()); command returns me false, maybe there is the problem, but the folder /tmp on my server has permission drwxrwxrwt.命令返回 false,可能有问题,但我服务器上的文件夹/tmp具有drwxrwxrwt.权限drwxrwxrwt.

If anyone can help me with this problem, since I followed several tutorials and nothing about the solution.如果有人可以帮助我解决这个问题,因为我遵循了几个教程而对解决方案一无所知。

Some providers do NOT grant access to the initialization file for PHP, but rather customers must use a local php.ini file with only the entries needed and allowed to set in a customer account.某些提供商不授予对 PHP 初始化文件的访问权限,而是客户必须使用本地 php.ini 文件,其中仅包含需要并允许在客户帐户中设置的条目。

In the server's Site Administration menu -> Server -> PHP Info what does the output show for upload_tmp_dir?在服务器的站点管理菜单 -> 服务器 -> PHP 信息中,upload_tmp_dir 的输出显示什么?

More than likely on a shared host, one cannot access edit the main php.ini, but one can set some things via their own local (in their account) php.ini file with the right 'snippets'.很可能在共享主机上,人们无法访问编辑主 php.ini,但可以通过他们自己的本地(在他们的帐户中)php.ini 文件使用正确的“片段”来设置一些内容。

Good luck, hope this helps.祝你好运,希望这会有帮助。

Well, the problem has been solved and it is more strange than I imagined, I will leave the answer here to help you if someone has the same problem.嗯,问题已经解决了,而且比我想象的更奇怪,如果有人遇到同样的问题,我会在这里留下答案来帮助你。

It was necessary to execute the command chmod 777 / tmp , but this command could not be executed since it gave an error that the folder was read-only (Ready-Only file system).必须执行命令chmod 777 / tmp ,但此命令无法执行,因为它给出了文件夹为只读(Ready-Only 文件系统)的错误。 To resolve this, it was necessary to mount and remount it, but I couldn't do it either, as it wouldn't let me remount the /tmp folder为了解决这个问题,有必要挂载和重新挂载它,但我也做不到,因为它不会让我重新挂载/tmp文件夹

For another reason I had to restart the server and magically the server let me change the permissions to 777 (from drwxrwxrwt. to drwxrwxrwx. ).出于另一个原因,我不得不重新启动服务器,而且服务器神奇地让我将权限更改为 777(从drwxrwxrwt.drwxrwxrwx. )。 With that problem solved.随着那个问题解决了。

I thank everyone who tried to help.我感谢所有试图提供帮助的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM