What are best practices for handling long-running shell commands in PHP to prevent page timeouts or user confusion?

When running long-running shell commands in PHP, it's important to prevent page timeouts and user confusion by executing the command asynchronously. This can be achieved by using functions like `proc_open()` or `exec()` with appropriate parameters to run the command in the background. Additionally, you can store the output of the command in a file or database for later retrieval.

// Example of running a long-running shell command asynchronously in PHP
$command = "your_long_running_command_here > /dev/null 2>&1 &";
exec($command);