Welcome Guest, Not a member yet? Register   Sign In
upload error - open_basedir restriction in effect
#1

[eluser]joshua rajamani[/eluser]
i have an error while upload the file to my server.

ERROR 1:

A PHP Error was encountered

Severity: Warning

Message: getimagesize() [function.getimagesize]: open_basedir restriction in effect. File(/tmp/php_upload/phpRRfeCz) is not within the allowed path(s): (VIRTUAL_DOCUMENT_ROOT:/usr/local/lib/php:/usr/local/lib/ph:/home/chroot_lib/phplib/:/usr/local/bin/)

Filename: libraries/Upload.php

Line Number: 571

ERROR 2:

A PHP Error was encountered

Severity: Warning

Message: getimagesize(/tmp/php_upload/phpRRfeCz) [function.getimagesize]: failed to open stream: Operation not permitted

Filename: libraries/Upload.php

Line Number: 571
#2

[eluser]bretticus[/eluser]
You are not allowed to upload to /tmp in that system. Upload to a folder inside your webpage virtual root.
#3

[eluser]joshua rajamani[/eluser]
how to create virtual root
#4

[eluser]bretticus[/eluser]
[quote author="joshua rajamani" date="1249591090"]how to create virtual root[/quote]

Somewhere in your upload code is a path you can set. If you are using CI's uploader class than you need something similar to:

Code:
$config['upload_path'] = './uploads/';        
$this->load->library('upload', $config);

The ./uploads/ path refers to a folder named "uploads" in the same folder as your index.php page (the folder than contains your index.php file and this upload folder you will create is your virtual root.)

Make sure that this new uploads folder is owned by the web server user. You can find this information via phpinfo(). Look under apachehandler* and User/Group (the webserver may already run as your user. If so you probably don't need to worry about permissions.)
#5

[eluser]joshua rajamani[/eluser]
$config['upload_path'] = './uploads/';
$this->load->library('upload', $config);

like that codes to upload the file, but file cannot move.

In local phpinfo:

open_basedir no value no value

But in online server:
open_basedir VIRTUAL_DOCUMENT_ROOT:/usr/local/lib/php:/usr/local/lib/ph:
/home/chroot_lib/phplib/:/usr/local/bin/ no value


how to change the open_basedir value to novalue.




Theme © iAndrew 2016 - Forum software by © MyBB