【发布时间】:2014-05-14 02:28:45
【问题描述】:
我正在尝试在 XAMPP 中使用 phpMyAdmin 导入一个大的 .sql 数据文件。然而,这需要很多时间,我不断得到:
致命错误:第 285 行的 C:\xampp\phpMyAdmin\libraries\dbi\DBIMysqli.class.php 中的最大执行时间超过 300 秒
文件大约有 120 万行。
该文件大约 30MB 大,所以不是那么大。我真的不明白为什么要花这么长时间。
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time=30000
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time=60
; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64
; How many GET/POST/COOKIE input variables may be accepted
; max_input_vars = 1000
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit=200M
这是xampp中php.ini的配置文件,由于某种原因我仍然得到
致命错误:第 285 行的 C:\xampp\phpMyAdmin\libraries\dbi\DBIMysqli.class.php 中的最大执行时间超过 300 秒。
【问题讨论】:
-
增加时间限制。检查您的服务器配置。 300已经很高了。默认值为 30。
-
是的,但是在 300 行中,我只能到达 120 万行中的第 285 行。虽然文件大约 30MB,但我真的不明白为什么要花这么长时间。
-
那不是你的sql文件的行号,而是你的php。
-
默认情况下,从命令行而不是通过 Web 服务运行的脚本没有最大执行时间限制。处理数百万个数据点的脚本实际上不应该在 Web 服务器的上下文中运行,因此我强烈建议您重构脚本以改为从命令行运行
标签: php mysql sql phpmyadmin xampp