wordpress - Long PHP script resulting in 500 error at 10-minute mark
Get the solution ↓↓↓I have max_execution_time set to 30 minutes, but this long-running loop is resulting in a 500-error at exactly the 10 minute mark each time.
How can I prevent that, what PHP setting is causing the 10-minute timeout?
Is there a better way to run this long loop? It's in a WordPress plugin activiation file, where it's grabbing up a large DB table of user-likes, which users liked which post, and assigning that meta to the post/activity itself.
global $wpdb;
$rows = $wpdb->get_results( "SELECT activity_id FROM wp_wpsn_activity_likes GROUP BY activity_id" );
foreach ( $rows as $row ) {
$act_id = $row->activity_id;
$prep = $wpdb->prepare( "SELECT user_id FROM wp_wpsn_activity_likes WHERE activity_id = %d", $act_id );
$user_ids = $wpdb->get_col( $prep );
bp_activity_update_meta( $act_id, 'wpsn_likes', serialize( $user_ids ) );
}
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: can't write image data to path
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.