> Here are my questions (first): > What sort of monster could possibly cause ini_get("file_uploads") to > return > Off even though php.ini has file_uploads = On? First and foremost, confirm that the php.ini you changed is the same file PHP is actually using. Create a phpinfo.php file with: <?php phpinfo();?> and surf to it on your server. Use browser "Find" menu to find "php.ini" and see where PHP is expecting php.ini to be. Put php.ini there. Second most common cause of this is changing php.ini and not re-starting Apache (or *thinking* you re-started apache, but you didn't) You can maybe check: http://example.com/server-status (or is it server_status) to see Apache up-time. (Alas, nobody has PHP uptime for you) It's also possible that you would have an .htaccess file turning file_uploads back Off in your directory, or even an auto_prepend_file turning them Off, but that's pretty unlikely to happen without you knowing it. Very remotely possible, your ISP webhost could have hacked PHP source to make file_uploads be Off no matter what you do, cuz they really hate file_uploads. > And how can I slay this monster? Move php.ini and/or re-start Apache > Here is my history (last): > I am running redhat, apache 1.3.23, & PHP 4.3.9. upload_tmp_dir = > "/var/www/ultmp" and apache runs as user "apache". > > I have a form which POSTs a request of multipart/form-data -- specifically > a > binary file -- to a php script. I am using "LiveHTTPHeaders" extension > for > FireFox to prove that my browser /is/ in fact composing this request in a > syntactically appropriate idiom. However, in PHP the $_FILES array comes > out of print_r() as just "array ( )" always, and no file is being sent to > the upload directory. You are sure you've got ENCTYPE="multipart/form-data" right? > First thought was that the cause was insufficient permissions for the > "apache" user: > I chmod'ed the directory /var/www/ultmp to 777 and chown'ed it to apache. > I > am assuming that the temp directory does not have to be (and really should > not be) a world-readable. I was able to determine that the cause /is not/ > a > problem with the permissions of the user "apache" by adding into my PHP a > call to mkdir() which creates a directory off of the directory in my > "upload_tmp_dir" directive. (And verified that the directory does in fact > begin to exist following the script's execution.) Your /var/www/ultmp directory *DOES* need to be write-able and executable by Apache owner, whether through ownership, group, or world permissions, almost for sure. > Second thought was that the cause was with php.ini or http.conf. > I have checked apache error_log: nothing. I tried setting upload_tmp_dir > to > (nothing), to "/var/www/ultmp/", and to "/var/www/ultmp"; still nothing. > I > must admit that I still have not completely determined the cause to be > not-apache, but I have no leads except this one in PHP, and my searches of > http.conf yeild no tangible results. > > I am using a wonderful script [http://www.epiware.com/scripts/upload.php] > to > troubleshoot my uploading woes. I am unable to upload small and large > files > alike. > > In my php.ini file, I have the following directives/values > file_uploads = On > upload_tmp_dir = "/var/www/ultmp" > upload_max_file_size = 2M > max_execution_time = 30 > post_max_size = 2M > > > But the spark in my curiousity: when I do phpinfo() in my > post-action-script, I see for the file_upload directive the "Local Value" > goes to Off. My guess is that what ever is causing "Local Value" to go to > Off even though "Master Value" is On (I did try restarting the server) is > also causing my $_FILES variable to be empty and my actual file data to be > thrown into the trash. Aha! Now we know for sure it *IS* an .htaccess file, or, most unlikely from what you say, a setting in httpd.conf that looks like: php_flag file_uploads Off Off may be 0 or False (I think) as well. It may even be php_value instead of php_flag if that's not a boolean, though I think it is. And in newer versions of PHP, they may have gone with php_value for all settings, even boolean ones. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php