SugarCRM Request Timeout - php

I'm using SugarCRM to fetch records (more than 1000+ records) in Cases.
I already set up config_override.php:
$sugar_config['max_record_fetch_size']= 1200;
php.ini:
max_execution_time = 3600;
I still get the timeout error. What else do i need to change?

set max execution time to 0 so that it will not through timeout error...but you need to optimize your code or query to get records.
max_execution_time(0);

In SugarCRM 7.6, theres a new configuration to override api.timeout
$sugar_config['api']['timeout'] = 180; //default 3 minutes
so i need to override the time to a higher value for me to avoid the Request timeout error :-)

Related

How to set php max execution time in millisecond?

Is there any way to set php max execution time less than a second?
or
How can we handle it in code level like return a json message to show "Exceeded max allowed response time"?
No, you can't set max_execution_time less than the seocond. Also, You can not change this setting with ini_set() when running in safe mode. The only workaround is to turn off safe mode or by changing the time limit in the php.ini.
max_execution_time
But you can emulate it with a function as this post
declare(ticks=1);
$start = microtime(1);
register_tick_function(function () use ($start) {
(microtime(1) - $start < 0.8) or die();
});

PHP Script stops working after 60 seconds

I'm trying to create a form just to mess around with and I there are two sections of this form. The first input is a number to count up to and the second input is a delay interval in seconds.
I have two ways of doing this. One, is to do this client side and the other is to take the variables and send them via php. This will allow the user to leave the website and have the script still working.
The issue with this being server side is that after 60 seconds, the PHP script stops working. The form is being sent via AJAX. Here is my PHP code. I'm also on shared hosting and do not have the ability to edit PHP.ini.
$amount = $_POST["amount"];
$time = $_POST["time"];
date_default_timezone_set('America/Los_Angeles');
$x = 0;
while($x < $amount) {
echo $x;
$x++;
sleep($time);
}
echo ("Counted to " . $x);
You can use max execution time on your php file, add this line in your php file.
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
You can use set_time_limit to set the max execution time, and 0 means no time limit (not recommanded for cgi, since you web server, apache/iis still have a time limit)
and if you want to change your execution time limit of all the php scripts, you can change the setting max_execution_time in the php.ini

Getting "Maximum execution time" error intermittently

I am facing this problem, firstly I would like to say that I am very new to PHP and MySQL.
Fatal error: Maximum execution time of 30 seconds exceeded in
.........................\cdn\wished.php on line 3
I don't know what is wrong in line 3, its giving error only sometimes. Here's my code:
<?php
//wished.php
$CheckQuery = mysql_query("SELECT * FROM users WHERE ownerid='$user->id'");
$wished = 0;
while($row = mysql_fetch_assoc($CheckQuery))
{
// echo $row['fname']."<br/>";
$wished++;
}
echo $wished;
?>
It was perfect when I run this in localhost with XAMPP. As soon as I hosted my app on my domain and used their database, it start getting error.
thanks every one :)
The issue is that the SQL query is taking too long, and your production PHP configuration has the PHP script time limit set too low.
At the beginning of the script you can add more time to the PHP time limit:
http://php.net/manual/en/function.set-time-limit.php
set_time_limit(60);
for example to add 30 more seconds (or use 0 to let the PHP script continue running).
If your production database is different than your development DB (and I'm assuming production has way more data) then it might be a really expensive call to get everything from the user table.

Getting HTTP 500 Internal Server Error, Webservice PHP/NuSOAP on resultset with more than 1000 rows

I handle a small webservice with two methods, everything is running great until the resulset returns more than 1000 rows.
I know I have to put some code here, but the project is very confidential, so I put only basic Nosuap object parameters.
$namespace = 'urn:server';
$server = new nusoap_server;
$server->configureWSDL('SOME_NAME', $namespace);
$server->wsdl->schemaTargetNamespace = $namespace;
$server->register('ws_consultar_reclamos',
array('fechas' => 'tns:fechas_array'),
array('return' => 'tns:reclamacion_array'),
$namespace,
'urn:server#ws_consultar_reclamos',
'rpc',
'encoded');
I repeat, everything runs great until the resultset has more than 1000 rows.
I'm using PHP with NuSOAP.
Is there any configuration that I have to change to accept a bigger resultset?
Please help me, I'm running out of time with this situation.
Thanks a lot!
In case you haven't done it yet, activate logging:
error_reporting = E_ALL
log_errors = On
Have you tried to increase the memory limit in php.ini?
script may be timing out. perhaps try settig the script timeout higher with
set_time_limit();
set_time_limit()
or modify it in your php.ini file. its default to thirty so if you change it to 60 and all of a sudden 1000 rows works this is probably your issue. 5 minutes should be a safe bet, but good luck getting a user to wait that long.

PHP Max Exection Timeout Notification

Is it possible to get Max Execution timeout notification so that i can use code clean up operations before the php script stops running?
Basically, i am trying to create a script that can do some changes/modifications to my database which has huge data pile. Also, this php script execution can be paused/resumed using a filelock.
You can either use set_error_handler() or register_shutdown_function().
Edit: See also: max execution time error handling
If you set 0 to set_time_limit, it will never stop :)
You can increase the limit time inside your code using:
set_time_limit(300); //time in seconds
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
or
changing the max_execution_time parameter inside your php.ini.
The default time is 30 seconds.

Categories