Solved

How to set the max_execution_time to something lower than default during runtime?

Posted on 2011-02-28
4
506 Views
Last Modified: 2012-05-11
How to set the max_execution_time to something lower than default during runtime?

I tried ini_set('max_execution_time', 1); and the script will run for more than 1 second.  I do not want to change the default setting in php.ini file.  This is only going to apply to a single method.
0
Comment
Question by:computerhxr
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
larsrohr earned 500 total points
ID: 35004234
You can try overriding the max_execution_time within your php script itself, using the command:
   set_time_limit ( 1 );
0
 

Author Comment

by:computerhxr
ID: 35004278
set_time_limit (1); adds 1 second to the max_execution_time
0
 
LVL 12

Expert Comment

by:larsrohr
ID: 35004312
It shouldn't:  http://www.php.net/manual/en/function.set-time-limit.php
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini.

However, you need to have this near the top of your script, because it resets the count when the call to set_time_limit is made.
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 35004314
Hi,

create an .htaccess file  in root folder it would resolve ur all execution time issue
and paste

RewriteEngine On
php_value post_max_size 1000M
php_value upload_max_filesize 2500M
php_value max_execution_time 6000000
php_value max_input_time 6000000
php_value memory_limit 2500M
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now