hi everyone,
in my server, i am running a script thats uses curl heavily and it usually takes about 5 minutes to finish running. It used to wokr in my previous server, however, once i moved into my new server, it runs only for 30 seconds. In my php.ini, the max_execution_time is set to 1200 but it still runs only 30 seconds. What do you guys think I should do?
thanks in advance :)

max_input_time can override max_execution_time but this was supposed to have been fixed in 5.3.1. What PHP version are you using?

I am running php 5.3.3
my max_input_time is set to 300
does that make sense at all?

Not really although you could set it to 1200 to match the execution time or -1 (its default value). I think the max_execution_time shows in phpinfo().
Can you output that and check the value you see there matches what you have the ini file?

its the same thing... i changed it now to 2000 but still no change... do u think it might be from the server's ram?

It's starting to look like something else is the problem. Not sure how much more help I can be...

Put that in begining of your code

set_time_limit(2000);

Couple things:

  1. Use phpinfo() to make sure that the value is actually being changed or not. If your host runs PHP as FastCGI, you may need to kill the cgi processes.

  2. Your host may be killing the process using a different mechanism. This is common on many hosting providers such as HostGator, who kill processes that run longer than 5 minutes. Other hosts might have different rules, I wouldn't be surprised to see a process killed after 30 seconds on shared hosting.

you can try a couple of things like ini_set('max_execution_time', '3000');
or

in your htaccess file:

<IfModule mod_php5.c>
php_value max_execution_time 3000
</IfModule>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.