0

I'm working on my own VPS server. My codes are down there. I changed the folder permissions to 777. I am using PHP 7.0 and 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. File(/tmp) is not within the allowed path(s): (/var/www/) in Unknown on line 0, referer: http://localhost:8080/

-File upload error - unable to create a temporary file in Unknown on line 0, referer: http://localhost:8080/

i am new user on 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
Mahir Altınkaya
  • 407
  • 6
  • 15

1 Answers1

0

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.

Mahir Altınkaya
  • 407
  • 6
  • 15