Force file download in WordPress

You get the error because WordPress attempted to parse the request which means WordPress tries to find a resource such as a post or category archive which matches the request URL (/download.php), and when not found, WordPress sets the HTTP status header to 404 Not Found.

So to fix the issue, you could use parse_request instead of template_redirect, or call status_header() when you set the other headers. E.g.

if(file_exists($file_path)) {
    status_header( 200 );

    // ... your code.
}

And BTW, as I said in the comments, you should use readfile($file_path) — just a reminder..

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)