CodeIgniter Forums
error log from exec? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: error log from exec? (/showthread.php?tid=77039)



error log from exec? - richb201 - 07-14-2020

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? 


RE: error log from exec? - paulbalandan - 07-17-2020

(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 



RE: error log from exec? - richb201 - 07-17-2020

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?


RE: error log from exec? - paulbalandan - 07-18-2020

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.


RE: error log from exec? - richb201 - 07-18-2020

(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.


RE: error log from exec? - paulbalandan - 07-18-2020

Can you try editing the max_execution_time ini setting?