简体   繁体   中英

php max execution time ignoring php.ini

I am trying to export a large database via phpMyAdmin. I jeep getting an error that the script stopped because the maximum execution time of 600 seconds was reached (or something like that). I tried setting max_execution_time in php.ini to 0 and -1. The change takes effect as I can see it in phpinfo() , but I am still getting the error. Another strang thing is that originally (before I changed it to 0) it wasn't 600 either. It was 180! Where is this 600 set?

See if it is manually set somewhere. Assuming you are on a UNIX type platform:

find /path/to/root/of/phpmyadmin -name "*.php" -print0 | xargs -0 grep "max_execution_time"

Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. See your web server documentation for specific details.

Don't use phpMyAdmin to import large files. Try using the mysql CLI to import a dump of your DB. Transfer the SQL file to the server and execute the following on the server using PHP script like shell_exec or system

mysql --user=user --password=password database < database_dump.sql.

Of course the database has to exist, and the user you provide should have the necessary privilege(s) to update the database.

PHP by default places resource limits on all php scripts using the following three directives: => max_execution_time : Maximum execution time of each script, in seconds (default 30 seconds)

=> max_input_time : Maximum amount of time each script may spend parsing request data (60 seconds)

=> memory_limit : Maximum amount of memory a script may consume (default 8MB)

Your php script was timed out may be because of resource limits. All you need to do is setup a new resource limits so that the script will get executed.

If that doesn't work either,you can set it with set_time_limit(N) function, which sets the time limit in seconds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM