shlomikalfa Posted April 21, 2008 Share Posted April 21, 2008 hey there, i am trying to set up a large text upload [31578+ chars]. I have a program to make the text send, it uses http1.1 tcp send method however i don't know how to set it correct to work with a corresponding PHP script. -> A. the program is forming the data into a proper http entity, [iE. < or <] -> that data is then sends to a php page using different headers to mark each content. ** The TCPSend method is used once to send the entire content. [is that how it should be done ?!] -> Php page should receive and analyze the contents accordingly [this works well i assume]. Headers: .- Post method. .- Content type: application/x-www-form-urlencoded .- Connection: close Now... what's the issue right ?! =>>> the thing is, it works perfectly for small sizes of text [1000 chars] but when i'm using large text [31000+ chars] it seems to fail and stuck... any idea ?! Quote Link to comment Share on other sites More sharing options...
miracle_potential Posted April 21, 2008 Share Posted April 21, 2008 YOur server could be running out of memory open notepad and save a file called .htaccess with php_value memory_limit 16M top line Thats it because you'll probably find that your file was so big it beat the server up lol Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 21, 2008 Author Share Posted April 21, 2008 well, i've added that line to my own .htaccess: AddType x-mapp-php5 .php php_value memory_limit 16M but now i get a 500 internal server error. Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 21, 2008 Author Share Posted April 21, 2008 i have ran into this while looking for ppl with the same error but couldn't understand anything: I found a solution for the "500 error" problem. At least it worked on my webspace. Delete this information from the .htaccess file: [code]<IfModule !mod_rewrite.c> # ugly ugly hack to detect missing mod_rewrite # RedirectMatch must be to an absolute destination, so forces 500 error... ErrorDocument 500 "Elgg error: Apache does not have mod_rewrite loaded. Please check your apache setup." RedirectMatch 302 .* index.php </IfModule> <Files "htaccess-dist"> order allow,deny deny from all </Files> # Default handler DirectoryIndex index.php # php 4, apache 1.x <IfModule mod_php4.c> # default memory limit to 16Mb php_value memory_limit 16777216 # to make sure register global is off php_value register_globals 0 # max post size to 8Mb php_value post_max_size 8388608 # upload size limit to 5Mb php_value upload_max_filesize 5242880 # hide errors, enable only if debug enabled php_value display_errors 0 </IfModule> # php 4, apache 2 <IfModule sapi_apache2.c> # default memory limit to 16Mb php_value memory_limit 16777216 # to make sure register global is off php_value register_globals 0 # max post size to 8Mb php_value post_max_size 8388608 # upload size limit to 5Mb php_value upload_max_filesize 5242880 # hide errors, enable only if debug enabled php_value display_errors 0 </IfModule> # php 5, apache 1 and 2 <IfModule mod_php5.c> # default memory limit to 16Mb php_value memory_limit 16777216 # to make sure register global is off php_value register_globals 0 # max post size to 8Mb php_value post_max_size 8388608 # upload size limit to 5Mb php_value upload_max_filesize 5242880 # hide errors, enable only if debug enabled php_value display_errors 0 </IfModule> Make sure, that you're mod_rewrite is ON and your register_globals and safe_mode ware OFF. Then you have to set "data" to CHMOD 777. I hope it works, have fun [/code] bah !!! Quote Link to comment Share on other sites More sharing options...
miracle_potential Posted April 21, 2008 Share Posted April 21, 2008 That was instructions on how to edit the internal server .htaccess file, although it does raise the doubt that maybe your file is over the default 5MB in size? Also this could be a problem with your HTTPD file although I'm not too wise on that one. But its true I didnt think of mod_rewrite try doing some reasearch into it I'll have a quick look I had a similar problem on an FTP program I made with PHP it turned out to be the servers memory and file size limits being too small. As so I contacted the help! hehe good luck mate Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 21, 2008 Author Share Posted April 21, 2008 well... i don't get it... there is no way the text is over 5mb, it's not a file... it's merely text... a freakin' long text but yet it's just some text trying to be uploaded... about 31K chars.... it should be around 600Kb that's it... Any other idea perhaps ? Quote Link to comment Share on other sites More sharing options...
miracle_potential Posted April 21, 2008 Share Posted April 21, 2008 are you posting it to a database or to a file? ----EDIT---- If its a database you'll find theres a character limit on it and you'll have to store it as a file, PDF or something using the PDF_write stuff again not too wise on that subject as my server doesnt support it And if its a file check your code in every aspect even the slightest thing could be making your server reject the new found file or anything at all ------------ Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 21, 2008 Author Share Posted April 21, 2008 well, i'm trying to post it into a database... -> what's the character limits then ?! if you refer to the one i can set through the mySQL database then it should do i've set it to Bulb. Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 22, 2008 Author Share Posted April 22, 2008 maybe it has something to do with the set_time_limit value ? Quote Link to comment Share on other sites More sharing options...
miracle_potential Posted April 22, 2008 Share Posted April 22, 2008 I was just about to say is your table in full text? why I didnt ask at first I have no idea Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 22, 2008 Author Share Posted April 22, 2008 i did thought of a possible reason as to why does the script gets stuck... maybe it's because i'm trying to send 300K+ chars in one line ?! --> i've just splitted it to many lines and it seems like it wasn't 30K chars... it's about 300K.... resulting in a file of 304Kb text. is there a limit for the HTTP1.1 headers line length ?! if so how should i split the text into lines without harming it's integrity ?! about my DB, it should be ok... i don't even get to that part of getting the error.... Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 22, 2008 Author Share Posted April 22, 2008 Well... this is my TCP send details to whom my be interested: www.e-lephant.org/TCPSendInfo.txt Does anyone have any idea what so ever ???? Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 22, 2008 Author Share Posted April 22, 2008 Anyone has any clue what so ever, please? Quote Link to comment Share on other sites More sharing options...
shlomikalfa Posted April 22, 2008 Author Share Posted April 22, 2008 For those which will have the same issue: -> Cut the send into chunks not bigger then 4096 chars and send it in chunks. *** Only the last chunk should be followed by a CRLF. Enjoy. [move]THANKS TO ANYONE WHO HAVE HELPED/TRIED TO HELP !!!![/move] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.