Run cached PHP scripts if error found

Using a Nginx web server, in case a PHP script has some error, how can you serve a cached version of the working file instead?

I’m currently seeing this behavior in a server, but I couldn’t find a clue to avoid it, so I’m now asking to sys admins experts instead of programmers.