GoDaddy PHP和共享的Windows Server文件上传问题 [英] GoDaddy PHP and shared Windows Server file uploading issues

查看:199
本文介绍了GoDaddy PHP和共享的Windows Server文件上传问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的客户设置了一个PHP CMS,并且无法让文件上传工作。



我的客户位于GoDaddy.com共享运行PHP 5的Windows IIS 7.0服务器。
我无法切换到Linux,因为我的客户端在使用ASP.NET的GoDaddy帐户上托管了其他站点。我试图切换到Linux和这些网站失败,所以我坚持与Windows。

正如你可以看到我已经使用了绝对路径: b $ b upload_tmp_dir = D:\主机\2556240\html\mytemp



但似乎什么也没做。我运行我的上传脚本时出现此错误:
$ b


警告:move_uploaded_file()[function.move-uploaded-file]:无法将D:\temp\TMP\php895B.tmp移动到D:\主机\2556240 \html\admin_class\simpleIMG.php中的img / 1291406212_slideshow_run.jpg上。 >

尽管我设置了upload_tmp_dir,你可以看到它在 phpinfo(),我还看到下面列出的TEMP / TMP目录:

$ TEMP d:\temp\tmp

TMP d:\temp\tmp

_SERVER [TEMP] d:\temp\tmp

_SERVER [TMP] d:\temp\tmp



session.save_path D:\ TEMP \ PHP

(我已经尝试将session.save_path更改为与upload_tmp_dir相同的绝对路径,但后来我的PHP会话()登录脚本停止工作。我不得不把它改回D:\ TEMP\PHP)



帮助!
我知道有一种方法可以让我在Windows服务器上使用文件上传脚本。



有什么我在我的 php.ini 文件?或者是否有另一种上传文件的方式?

解决方案

像Francisco,我使用GoDaddy的web门户解决了这个问题。

在文件管理器中,转到要保存上传文件的特定文件夹(如果有上传的整个目录结构,则转到父文件夹)。选择文件夹,然后单击隐私按钮以更改权限。

取消选中继承权限框,然后选中Web Writable。如果有上传的目录结构,则应检查导致子文件夹继承Web Writable权限的复选框。



安全警告:不要使Web根目录可写。不要让任何PHP代码可写的目录。如果您是应用程序开发人员,请考虑将文件保存在数据库中,而不是在您的Web服务器上具有可写目录,这是常见的攻击媒介。


I'm setting up a PHP CMS for my client and I'm having trouble getting the file uploading to work.

My client is on a GoDaddy.com shared Windows IIS 7.0 server running PHP 5. I can not switch to Linux because my client has other sites hosted on his GoDaddy account that use ASP.NET. I tried switching to Linux and those sites failed, so I'm stuck with Windows.

As you can see I have used an absolute path for this:
upload_tmp_dir = D:\Hosting\2556240\html\mytemp

But it seems to have done nothing. I get this error when I run my upload script:

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\temp\TMP\php895B.tmp' to 'img/1291406212_slideshow_run.jpg' in D:\Hosting\2556240\html\admin_class\simpleIMG.php on line 48

Even though I set up my upload_tmp_dir, and you can see that it's there in my phpinfo(), I also still see the following TEMP/TMP directories listed as:

TEMP d:\temp\tmp
TMP d:\temp\tmp

_SERVER["TEMP"] d:\temp\tmp
_SERVER["TMP"] d:\temp\tmp

session.save_path D:\TEMP\PHP
(I have tried changing this session.save_path to the same absolute path I have for upload_tmp_dir, but then my PHP session() login script stopped working. So I had to change it back to D:\TEMP\PHP)

Help! I know there's got to be a way for me to use a file upload script on a Windows server.

Is there something I'm missing in my php.ini file? Or is there an alternative way of uploading files that would work?

解决方案

Like Francisco, I fixed this issue by using GoDaddy's web portal.

In the file manager, go to the specific folder where you want the uploaded files to be saved (or to the parent folder if there's a whole directory structure for uploads). Select the folder and click the Privacy button to change permissions.

Uncheck the Inherit Permissions box, and then check Web Writable. If there's a directory structure for uploads, you should check the box that causes sub-folders to inherit the Web Writable permission.

Security warnings: Do not make your web root writable. Do not make any directory that has PHP code writable. If you're an application developer, please consider saving files in the database rather than having writable directories on your web server, they are a common attack vector.

这篇关于GoDaddy PHP和共享的Windows Server文件上传问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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