How can one effectively stop a PHP script running an endless loop on an external web server?

To stop a PHP script running an endless loop on an external web server, you can set a timeout limit using the `set_time_limit()` function in PHP. This function specifies the maximum amount of time in seconds that the script is allowed to run before it is terminated. By setting a reasonable timeout limit, you can prevent the script from running indefinitely and consuming server resources.

// Set a timeout limit of 30 seconds
set_time_limit(30);

// Your endless loop code here
while (true) {
    // Code inside the loop
}