note 9240 deleted from features.file-upload by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 20:32:03 +0000 |
| Subject: | note 9240 deleted from features.file-upload by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25335@lists.php.net to get a copy of this message | ||
Safe mode:
Something that *almost* caught me out, and nearly prompted me to submit a bug report before I
spotted a similar one (with solution).... that isn't documented here.
If you are running with safe_mode on, your scripts whose uid's are not 0 will not be able to
access uploaded files from /var/tmp/php[XYZ] (or whatever your tmp dir is), because as the file is
written to the directory it appears to take on the ownership from that directory.
Solution: Set upload_tmp_dir in your php.ini file/Apache config, to be "./tmp/". This
causes any uploaded files to be written to the tmp subdirectory from the same directory as the
script was executed from, e.g, a file processed by /usr/local/apache/htdocs/test/upload.php will be
written to /usr/local/apache/htdocs/test/tmp/file.txt
The ballache is you've got to create those tmp directories by hand (and generally 777 them).
What would be nice is if files were written to /var/tmp/phpXYZ and then chowned to the respective
safe_mode UID/GID.
-Steven