Apache errors when retrieving taxonomies

It’s a PHP error, not an Apache error.

What’s happening is that get_the_terms() returns an array of terms, or false if there are no terms or the post doesn’t exist.

You can fix this like this:

$thiscategory = get_the_terms( $post->ID, $taxonomy_name );
if ( is_array( $thiscategory ) ) {
    // Only runs if $thiscategory is an array.
    $thiscategory = array_values( $thiscategory );  // This is line 4
}
$section = get_post_type( $post->ID );
$thispost = $post->ID;