the_ut_tick Posted March 22, 2007 Share Posted March 22, 2007 Hi, I have an extremely large text file (9GB) of data that I am trying to get into MySQL. I have a php code that opens the file, reads in the data line by line and stores each line in the appropriate database. The problem is that the server that I am using won't allow the file to be opened for more than 30 seconds. To get around this, I started doing a ftell after each line write and then when the program is rerun, that position is read from another text file and an fseek goes to that point to start again. The problem that I have is that occasionally, the ftell seems to return a 0 and the program starts from the begining. Am I overlooking something, or should I go another route? Thanks Link to comment https://forums.phpfreaks.com/topic/43829-large-file-and-ftell-fseek-problems/ Share on other sites More sharing options...
Lumio Posted March 22, 2007 Share Posted March 22, 2007 Put set_time_limit(0); to the front of your php-code. But remember: 9GB ... that's a lot of data Link to comment https://forums.phpfreaks.com/topic/43829-large-file-and-ftell-fseek-problems/#findComment-212783 Share on other sites More sharing options...
the_ut_tick Posted March 22, 2007 Author Share Posted March 22, 2007 good one, thanks any idea as to why ftell might occasionally report a zero? Link to comment https://forums.phpfreaks.com/topic/43829-large-file-and-ftell-fseek-problems/#findComment-212869 Share on other sites More sharing options...
Lumio Posted March 22, 2007 Share Posted March 22, 2007 ftell gives you only the position of the file-pointer: http://us2.php.net/ftell Link to comment https://forums.phpfreaks.com/topic/43829-large-file-and-ftell-fseek-problems/#findComment-212881 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.