• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error log from exec?

#1
I am running this line in my controller where I am converting a pdf to an png. 

exec('soffice --convert-to png {$file_uploaded} --outdir {$file_image}');  //convert to image

It is not working but I don't know why? Is there a place where error message from exec are logged? 
proof that an old dog can learn new tricks
Reply

#2
(07-14-2020, 01:04 PM)richb201 Wrote: I am running this line in my controller where I am converting a pdf to an png. 

exec('soffice --convert-to png {$file_uploaded} --outdir {$file_image}');  //convert to image

It is not working but I don't know why? Is there a place where error message from exec are logged? 

You can pass a 2nd and 3rd argument to the exec function. The 2nd argument must be an array and the 3rd must be an integer.

PHP Code:
$output = [];
$return = -1;
exec('soffice --convert-to-png {$file_uploaded} --outdir {$file_image}'$output$return);

// print the output
print_r($output);

// is this an error?
echo $return// if 1, then error; 0 if successful 
Reply

#3
Thanks. I managed to get this going. The only issue I have now is that if I am converting a large pdf (for example 20M) it takes a while. I have no problem with this but after 60 seconds (while it is still busy)I get a popup "An error has occurred on uploading.". Is there a timeout setting in php.ini that controls this?
proof that an old dog can learn new tricks
Reply

#4
If the script takes some time, maybe you can put a set_time_limit(); at the beginning of the time consuming script. Just pass as argument to set_time_limit your desired number of seconds before the script times out. Passing 0 will give unlimited time.
Reply

#5
(07-18-2020, 01:20 PM)paulbalandan Wrote: If the script takes some time, maybe you can put a set_time_limit(); at the beginning of the time consuming script. Just pass as argument to set_time_limit your desired number of seconds before the script times out. Passing 0 will give unlimited time.
I tried it out set_time_limit(). It is still timing out at 60 seconds.
proof that an old dog can learn new tricks
Reply

#6
Can you try editing the max_execution_time ini setting?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.