PHP- cannot change max_execution_time in xampp

独自空忆成欢 提交于 2019-12-01 17:07:06

You shouldn't let your crawler run under apache, it's better to run it stand-alone via cli as part of a Gearman setup.

That way it won't hog your web server and it can run as long as you want. You can find many bindings for Gearman that you can use, including PHP of course.

Try turning off safe mode in php and then try the below code

if( !ini_get('safe_mode') ){ 
    set_time_limit(0); //this won't work if safe_mode is enabled.
}

This should allow you to run the script for infinite time.

In Apache you can change maximum execution time by .htaccess with this line

php_value max_execution_time 200

set_time_limit() php manual ref.

use

set_time_limit(0);

at the top of the script

In WAMP there is three PHP.ini files so you might find 3 in xampp also, so just search for it with find and replace max_execution_time to what you are setting. But you must keep something small not too large as for speedy the app you running.

You could also try setting ignore_user_abort(TRUE); in your script as it might be the browser timing out rather than the script.

From the php.net manual

<?php
// Ignore user aborts and allow the script
// to run forever
ignore_user_abort(true);
set_time_limit(0);

See here for more info

http://www.php.net/manual/en/function.ignore-user-abort.php

If you are on windows, and this is a CLI run script maybe read this.

check phpinfo() from a temp script and search for max_execution_time. make sure that it has same value what you are setting. default should be 30 seconds. try to change it to a couple of different values and restart apache then check the value in phpinfo() to confirm.

if when you change the value it is reflected properly in the phpinfo() it means that there is some code in your script which is changing this value. search for two things in your code:

  1. search your code for ini_set() and check if it is change max_execution_time
  2. search for set_time_limit()

these functions can change maximum time limit of execution from script. otherwise you should check .htaccess from where this value may be set. but this will effect phpinfo() also.

I found the following in the xampp documentation. Maybe you are trying to edit the wrong php.ini file?

Why have changes in my php.ini no effect?

Since XAMPP 1.7.1 the "php.ini" is only in the directory "\xampp\php". Till XAMPP 1.7.0 is was in the directory "\xampp\apache\bin".

If a change in the "php.ini" have no effect, it's possible PHP is still using an other one. You can verify this with phpinfo(). Go to the URI localhost/xampp/phpinfo.php and search for "Loaded Configuration File". This value shows you the "php.ini" PHP is really using.

Info: After changing the "php.ini" you have to restart Apache, thus Apache/PHP can read the new settings.

what you are doing is just setting the max_execution_time to whatever inside your page. you can't change this using ini_set. you can change the memory_limit only.

see more details here... from the php official site.

if you want them to be changed, change in php.ini.

You have to change both of these in you php.ini ( and check if that's the right php.ini by finding the location in phpinfo(); output! )

max_execution_time = 0
max_input_time = 0

And after that check if some php file is not overwriting those variables locally.

vasanth252

open php.ini notepad file and search or find upload_max_filesize = 1000M and you should change on Post_max_filesize = 1000M then restart your xampp and refresh the local phpmyadmin..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!