NYCPHP Meetup

NYPHP.org

[nycphp-talk] using PHP to import large-ish SQL into mysql

Daniel Convissor danielc at analysisandsolutions.com
Tue Oct 20 20:11:03 EDT 2009


Hi Marc:

FYI, in the future, when starting a new topic, make a whole new email, so 
it doesn't look like it's part of the thread you're replying to.  Now to 
your question...


> Problem is, the PHP script is terminating with a PHP error; server's  
> support thinks it's out of memory.

Why should anyone be guessing what the issue is?  PHP's error messages 
explain exactly what the problem is in plain English.  Please post the 
actual error message.


> $cmd = "/path/to/mysql -h hostname -u username --password=password  
> db_name < sqlfile.sql";
> exec( $cmd );

Yeah, that shouldn't involve PHP's memory.

Another thought, if this is (nearly) all you're doing, why involvine PHP 
at all?  Do it directly in a shell script.

import.cgi
---------
#! /bin/sh

/path/to/mysql -h hostname -u username --password=password \
    db_name < sqlfile.sql
---------

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list