Avoid execution time limits by adding:
ini_set('max_execution_time', 0);
Run the extraction process in the background, using Laravel Queue or another worker. Avoid using system functions (exec()
, shell_exec()
), as they can cause security issues and lack portability.