Jump to content

Override default temp directory in php


Recommended Posts

I am having problem with /tmp directory and i don't want it to be used as a default temp directory. We have a dedicated temp directory location and I wan to use it. I am getting the following error below:

 

 

SYSTEM WARNING: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp/Juf3OS) is not within the allowed path(s): (/data/somelocation/)

SYSTEM WARNING: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/tmp/tmpdpWiXN) is not within the allowed path(s): (/data/somelocation/)

 

My question is, how to override the default temp directory? Let's say i want to just declare /data/somelocation as my default temp directory.

Link to comment
https://forums.phpfreaks.com/topic/247261-override-default-temp-directory-in-php/
Share on other sites

basically a certain plugin is using the default temp location and i do not have permission to change the php.ini file. i think it uses the sys_get_temp_dir but since no value for the TMP, TEMP and TMPDIR, the default /tmp was used. at least can i override these values so that i can assign a temp directory of my own, say /data/otherlocation?

You probably need to add the path to your temp directory to your openbasedir list of allowed paths.

 

Sorry Doug, I'm a bit new with php, would you please let me know how can i do that? take note that i prefer to work on it on the code not on the server-side. but server admin let us allow to use /data/otherlocation as temp location.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.