You are here: Re: [PHP] POST multipart/form-data temp files not being created. File_upload directive is resetting to "No." « PHP « IT news, forums, messages
Re: [PHP] POST multipart/form-data temp files not being created. File_upload directive is resetting to "No."

Posted by Shawn Kelly on 09/29/44 11:10

Richard Lynch you are my new best friend! grep -n uploads
/etc/httpd/conf/httpd.conf tells me "279:php_admin_value file_uploads off".
I don't know how I could have missed it!

I changed httpd.conf to have php_admin_value file_uploads On and everything
worked like it was supposed to this morning before I had this headache!

My weekend officially begins!
*virtual beers all around*

/s

"Richard Lynch" <ceo@l-i-e.com> wrote in message
news:2417.66.99.91.45.1110579664.squirrel@www.l-i-e.com...
> > 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация