Big file?

Hi there, I quite recently bought a linode, and was wondering how to get this script working…

Here is the PHP code

For every line in there, it's suppose to add it into the database. It works for small files, however, the file I am working with is around 2gb

So I updated the memory allocation in php.ini yet, when I run this I get a blank page… any suggestions?

Thank in advance,

a new user

3 Replies

It could take quite some time to insert a 2GB file line by line. Are you sure it's not actually working, until your Web server times out? Try running it without going through the Web server.

As an aside, I think one of the biggest problems with PHP is that it encourages quoting rather than binding variables when passing commands to SQL. One mistake and you've got an injection attack. ~~[http://sqlrelay.sourceforge.net/sqlrelay/programming/phppeardb.html#bindvars" target="_blank">](http://sqlrelay.sourceforge.net/sqlrela … l#bindvars">http://sqlrelay.sourceforge.net/sqlrelay/programming/phppeardb.html#bindvars](

Ah, I wouldn't worry about injection attacks, the page is basically isolated from the rest of the content, with no input executed, except that which is escaped from the inserting method. With few even knowing how to access the front page.

Well, I set it up so it wouldn't time out, and it doesn't even load. Just generates a blank page, with no queries being executed. Ideas?

By the way, when I try this on another server, it inserts the queries… but, it stops at 50000, for quota reasons.

@1st:

Hi there, I quite recently bought a linode, and was wondering how to get this script working…

Here is the PHP code

It works for small files, however, the file I am working with is around 2gb

file reads an entire file into an array.. so you are trying to read a 2gb file into memory. Try fgets and insert one line at a time.

kenny

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct