Log in

View Full Version : Resolved php parsing/reading large text files



regicidedelferoz
06-27-2011, 08:50 AM
good day everyone ^_^

please help me with my problem,.

i am reading/parsing large text files,.

i read on the internet that the default memory limit of php is 16M

but why is it my program doesn't read my 8MB text file?,.

only those text files whose lower than 8MB are readable,.

can you enlighten me please?




thx in advance
more power to dynamic drive and to y'all
GOD Bless always,.

-regicide del feroz

james438
06-27-2011, 09:21 AM
What is your program? Browsers tend to read text files as text.

bluewalrus
06-27-2011, 01:14 PM
Are you getting it as POST data? POST has a default max size of 8mB.

regicidedelferoz
06-28-2011, 12:53 AM
@james438
sir,. my program is a php program that reads text file and parse it then creates a new text file for the result,.

my problem is, it can read and parse text files below 8mb but it can't read and parse 8mb above,.



@bluewalrus
yes sir im using POST data,. how to change its max size?,. or should i use GET data?,.




thx for your replies guys,.
thx for trying to help me,.


More power to you,.
GOD Bless always,.


-regicide del feroz

bluewalrus
06-28-2011, 01:01 AM
POST data has no max size set by the browsers so I'd recommend using post and just upping your max post size. Do you have access to your server or the php.ini file? If so find the max post size and up it. PHP.net says "memory_limit should be larger than post_max_size" so you may want to up that as well depending on what you make your max size.

regicidedelferoz
06-28-2011, 01:29 AM
sir, can you teach me how to set it through php script?,.

like the @ini_set("memory_limit", "100M")?

im using linux/unix os sir,.




thx for replying,.

God Bless,.

bluewalrus
06-28-2011, 01:50 AM
Assuming you have permission on the server this should do it.


@ini_set('post_max_size', '32M');

I never used this method I set it in the php.ini (the config file).

regicidedelferoz
06-28-2011, 02:33 AM
thx sir,. i'll try this one,. and i'll post if it's still aint working,.

im using linux and the ini file is in read only mode,.

how can i edit it on its php.ini sir?,.




thank you very much,. and so sorry for my being dumb,.

more power,.

bluewalrus
06-28-2011, 02:40 AM
If it it's read only it's not going to be writeable. If you have access and permissions on the server open the file and modify it. If you don't contact your host or admin and have them make the change.

regicidedelferoz
06-28-2011, 03:12 AM
what's the exact address of it from the php folder sir?


EDIT:
sir it is still ain't working,.
the:
@ini_set('post_max_size', '32M');

bluewalrus
06-28-2011, 04:04 AM
I'm not sure where the file is located, it varies by server. Try executing this



<?php
echo phpinfo();
?>

that should tell you where the file is located, it wont necessarily take the changes though...

regicidedelferoz
06-28-2011, 06:13 AM
sir, @ini_set('post_max_size', '32M') is not working,.

only @ini_set('memory_limit', '100M') is working,.

the phpinfo() shows the current value that you changed after using ini_set and i observed that only memory_limit has changed..

what does it mean sir?,.

i can't re-write/overwrite my .ini file, what should i do sir?,.

please help me,.




thx in advance,.

GOD bless



-regicide del feroz

bluewalrus
06-28-2011, 12:59 PM
My understanding of the ini_set is that it only sets it for the run of the script so you wont see the actually change in the phpinfo.


After looking at some other sites post_max_size can't be set with ini_set so you will have to contact your host or admin to up the setting manually.

You could also try the htaccess solution they have here http://www.sitepoint.com/forums/php-34/ini_set-post_max_size-751723.html

regicidedelferoz
06-29-2011, 12:17 AM
sir,. i already tried to changed the setting in the php.ini file,. but still nothing happened,.

i gonna try the .htaccess,.




thank you very much sir for your patience,.
you're still trying to help me,. thanks a lot,.


God Bless,.
more power

-regicide del feroz




EDIT:

sir,. does .htaccess working on linux?,. i tried to create an .htaccess but still nothing happened,.

bluewalrus
06-29-2011, 04:00 AM
I haven't used the htaccess before so I can't advise on that.

Does anyone else have any advise for regicidedelferoz??

djr33
06-29-2011, 04:14 AM
Does your host allow this? Have you tried to contact them? It may be blocked. Or you may risk your account being terminated if you do find a way around it-- read the TOS for the host to find out if this is the case.
They may allow it, and you can find out the best approach by contacting them.

regicidedelferoz
06-29-2011, 06:12 AM
sir, i also tried this step from a localhost and i got the same problem,.
so i think it's not about the host that i'm using,.


thx for your helps,.

more power,.

regicidedelferoz
06-30-2011, 03:47 AM
bump!

regicidedelferoz
06-30-2011, 07:42 AM
bump!

djr33
06-30-2011, 03:13 PM
We've already answered your question. This is not a problem with PHP. It is a problem with your server's configuration so you have two options: 1) hire someone to configure your server; 2) do it yourself (possibly contacting the host for information).

regicidedelferoz
07-01-2011, 01:46 AM
read carefully

sir, i also tried this step from a localhost and i got the same problem,.
so i think it's not about the host that i'm using,.

djr33
07-01-2011, 01:58 AM
I think it may be the same problem with both servers. I don't know what the default configuration for PHP is, but I don't think this is a problem with code. I think this is a problem with server configuration (your server, and your localhost server). Debugging servers is very different than debugging PHP code.
Have you contacted your host to ask about how to fix this?
You can also try to fix it on your localhost, but if your host can help you with your other server, that will probably be easiest.

If not, maybe you can post the code you are using and someone can test to see if it works on a different server.

regicidedelferoz
07-01-2011, 03:24 AM
i will try it first with my localhost then if i still i got the same problem i'll post my codes here,.

thanks for assisting me,.



more power to DD,.
GOD Bless


-regicide