make script execution to unlimited

前端 未结 3 731
故里飘歌
故里飘歌 2020-12-08 18:07

I need to run a script into localhost (xampp) which will generate 14400 records and adds them into database, I have set the max_execution_time = 50000000000, I

3条回答
  •  死守一世寂寞
    2020-12-08 18:45

    Your script could be stopping, not because of the PHP timeout but because of the timeout in the browser you're using to access the script (ie. Firefox, Chrome, etc). Unfortunately there's seldom an easy way to extend this timeout, and in most browsers you simply can't. An option you have here is to access the script over a terminal. For example, on Windows you would make sure the PHP executable is in your path variable and then I think you execute:

    C:\path\to\script> php script.php
    

    Or, if you're using the PHP CGI, I think it's:

    C:\path\to\script> php-cgi script.php
    

    Plus, you would also set ini_set('max_execution_time', 0); in your script as others have mentioned. When running a PHP script this way, I'm pretty sure you can use buffer flushing to echo out the script's progress to the terminal periodically if you wish. The biggest issue I think with this method is there's really no way of stopping the script once it's started, other than stopping the entire PHP process or service.

提交回复
热议问题