Jump to content

Image Uploading Error: open_basedir restriction in effect


Recommended Posts

I moved a Prestashop from a Zeus-server host to an Apache-server host as I was getting constant error messages in the backend when it was sitting on a Zeus server (security token related).

 

The previous error messages are all gone since the move but I now cannot upload new images.

 

I get the following error:

 

Warning: move_uploaded_file(): open_basedir restriction in effect. File(/tmp/PS5OeHV2) is not within the allowed path(s): (/php/includes/:/usr/local/pem/vhosts/149221/) in /usr/local/pem/vhosts/149221/webspace/httpdocs/mycompany.ie/modules/editorial/editorial.php on line 98

 

 

Line 98 in editorial.php refers t:

 

elseif (!$tmpName = tempnam(_PS_TMP_IMG_DIR_, 'PS') OR !move_uploaded_file($_FILES['body_homepage_logo']['tmp_name'], $tmpName))

 

 

 

My host told me:

 

The cause of this error is that the path for the tmp folder is wrong. The program is trying to upload the file to the following location:

 

/tmp/PSkkK0CJ

 

When PHP is running as an Apache module you need to provide the full path to the folder which in this case would be:

 

/usr/local/pem/vhosts/149221/tmp/

 

However, I have no idea where to do this. Can anybody help me please? I have another Prestashop installation with the same host that was installed directly onto the host server, i.e. not moved from elsewhere. This is working perfectly. I checked through the defines.inc.php files of both sites and the base directory is set exactly the same, so I am totally confused.

 

All help appreciated. Client has new winter stock in store and needs to urgently update the site! Thanks!!

Link to comment
Share on other sites

Found a link that suggested to go to line 27 in /config/config.inc.php and change the bold bit as shown:

 

 

/* No settings file? goto installer...*/if (!file_exists(dirname(__FILE__).'/settings.inc.php'))

{

$dir = ((is_dir($_SERVER['REQUEST_URI']) OR substr($_SERVER['REQUEST_URI'], -1) == '/') ? $_SERVER['REQUEST_URI'] : dirname($_SERVER['REQUEST_URI']).'/');

if(!file_exists(dirname(__FILE__).'/../install')) die('Error: \'install\' directory is missing'); Tools::redirect('install', $dir);

}

include(dirname(__FILE__).'/settings.inc.php');

 

 

Change the line above in bold to:

 

((is_dir($_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['REQUEST_URI'])

 

That finally sorted it!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...