[nycphp-talk] using PHP to import large-ish SQL into mysql
Damion Hankejh
d at ingk.com
Wed Oct 21 09:08:42 EDT 2009
Sounds familiar to an issue I had with uninformative 500 Internal Server
errors -- my script was timing out. Check your max script execution time
with:
echo ini_get('max_execution_time');
Extend it with:
set_time_limit($seconds); // has no effect if running safe_mode
---
Damion Hankejh | hankejh.com
On Wed, Oct 21, 2009 at 5:02 AM, Marc Antony Vose <suzerain at suzerain.com>wrote:
>
> Le Oct 21, 2009 à 8:11 AM, Daniel Convissor a écrit :
>
> 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.
>>
>>
> Sorry...I made a typo there. I meant that the script is terminating with
> a 500 Error (NOT a PHP error)...which means there is no log or useful error
> trail. All I see in the error_log is the dreaded "Premature end of script
> headers" error.
>
> It usually points to out of memory or some other config error (like a bunk
> shebang line in a CGI).
>
> In this case, the script works when I import the smaller tables, and gives
> the 500 Error when I try the larger tables, so I think out of memory is a
> pretty reasonable hypothesis.
>
> As I said, PHP's memory_limit is set to 90M by default (according to
> phpinfo()) and I tried upping it to 128M, and phpinfo() says it's set to
> that, also, so I'm a bit confused as to why one 16 MB file would exceed 90M
> on import, but hey, who knows.
>
>
> Another thought, if this is (nearly) all you're doing, why involvine PHP
>> at all? Do it directly in a shell script.
>>
>>
> I was using PHP partly because it's the language I'm most familiar with,
> but more importantly because I don't want to automatically import certain
> files; the decision to import is based on logic in the script, and some of
> that logic comes from information in the bigger web application it's a part
> of.
>
> I already rewrote the script in Perl, but still had issues with importing
> the larger tables there, too.
>
> I'm not really much of a shell scripter; perhaps I should see if I can do
> it that way.
>
> If anyone has any other strategy that can work in PHP, let me know.
>
> Cheers,
> Marc
>
>
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/Show-Participation
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20091021/9ae77102/attachment.html>
More information about the talk
mailing list