Opened 17 years ago
Closed 17 years ago
#5984 closed defect (bug) (fixed)
WordPress should not depend on access to /tmp/
Reported by: | hangy | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.5 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
In some restricted hosting environments, the user might not be able to write to /tmp/.
As wp-admin/includes/file.php uses that directory directly in download_url() and get_filesystem_method(), some functions like for example automatic updating of plugins do not work under those circumstances.
Alternatives could be to use a temporary directory under wp-content as default or have an option in wp-config.php to change this to another directory.
Attachments (4)
Change History (12)
#1
@
17 years ago
- Keywords has-patch added
- Owner changed from anonymous to hansengel
- Status changed from new to assigned
I made a patch for each of the two methods you suggested.
#2
@
17 years ago
the user might not be able to write to /tmp/.
Just an extra note on this, The user should allways be able to write to PHP's temporary directory, But, Some server setups are going to be half-arsed anwyay.
If PHP cant write to the specified directory, It'll try to create it in the systems Temp. directory.
#3
@
17 years ago
It is true that there will always be weird server setups and also assuming that one can write to sys_get_temp_dir() should be right in most cases. However, WordPress is probably used in the most awkward hosting environments one can think of, thus working around such problems as good as possible sounds pretty important to me. :)
I guess my "vote" would go to DD32's solution with the define renamed to hansengel's WPTEMPDIR. ;) My guess is that it is most likely that some dir in wp-content is writable (installer could check this?) than /tmp/ for all those server setups mentioned above.
While one obviously ditches the features of using a system-managed temporary directory using this approach as the default, it could be the most reliable one, cross-platform thinking. (Any idea how PHP on a Windows server reacts to a "/tmp/" path?)
Uses wp-content/tmp as a temporary directory