简体   繁体   English

PHP 7.0 move_uploaded_file()不起作用

[英]PHP 7.0 move_uploaded_file() doesn't work

I'm working on my own VPS server. 我正在自己的VPS服务器上工作。 My codes are down there. 我的密码在那儿。 I changed the folder permissions to 777. I am using PHP 7.0 and apache2. 我将文件夹权限更改为777。我使用的是PHP 7.0和apache2。 I tried turning it off in Safe mode. 我尝试在安全模式下将其关闭。 I don't see files in the Temp folder. 我在“临时”文件夹中看不到文件。 It also does not move to the folder I specified. 它也不会移动到我指定的文件夹。 Where am I doing wrong? 我在哪里做错了?

-Unknown: open_basedir restriction in effect. -未知:有效的open_basedir限制。 File(/tmp) is not within the allowed path(s): (/var/www/) in Unknown on line 0, referer: http://localhost:8080/ 文件(/ tmp)不在允许的路径内:(/ var / www /)在行0上的“未知”中,引荐网址:http:// localhost:8080 /

-File upload error - unable to create a temporary file in Unknown on line 0, referer: http://localhost:8080/ -文件上传错误-无法在第0行的“未知”中创建临时文件,引用网址:http:// localhost:8080 /

i am new user on apache2 我是apache2的新用户

//$_FILES["UploadImage]["name"] = eg. image.png

$path = '/var/www/uploads/';

$yuklenecek_dosya = $path . basename($_FILES['UploadImage']['name']);
var_dump(move_uploaded_file($_FILES['UploadImage']['tmp_name'], $yuklenecek_dosya));
// result : bool->false

I tried to produce the solution simply. 我试图简单地产生解决方案。 I saw that the permits I gave were not working. 我看到我给的许可证没有用。 I did the following respectively. 我分别做了以下工作。

php.ini -> open_basedir = none
php.ini -> system_temp_dir = "/ var / www / tmp /"
chmod 0777 / var / www / tmp /
chmod 0777 / var / www / uploads
and change php script

$ path = '/ var / www / uploads /';

this is work know. 这是工作知道的。 Thank you everyone. 谢谢大家。

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

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