Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.4k views
in Q2A Core by
I understand it can be useful at troubleshooting but it's a turn off to every visitor who stumble upon this page.

What options are there to replace this for a standard 404 error?
Q2A version: 1.5.2

2 Answers

+1 vote
by
This page should never appear in normal operation, so if it is, that's a bug - please tell me!

Anyway you can change what happens for DB errors by overriding qa_page_db_fail_handler(...) in a plugin, e.g. redirecting somewhere else or whatever.
by
I've seen this issue quite a few times on my site. Regardless of whether it's in a plugin or not, Q2A shouldn't be outputting SQL queries on production sites...
by
Thanks Scott, I'm interested in your view on this. So you think it would make more sense to make people fish the query out of their web server error logs? I guess I've always done it that way because it made debugging easier, but I can see why it's not ideal...
by
may be search engines wants a "clean 404 not found" page. If the search engine recognizes the query failure as 404, then no issues. However, can you add an option to show this error only for admins or IPs of admins?
by
Yes, the error should be stored somewhere. I guess it depends on the server settings, if the webmaster has display_errors=On and logging turned off, the errors aren't going to be found anywhere.

I suppose you could store it in a file that's accessible via the Q2A admin area for example (and easily found in the filesystem if the error means Q2A is not accessible at all). Q2A has a debug option, right? That could be used to display errors and stuff on the site, in the case a user cannot use logging.

Pretty much anywhere you look it's frowned upon to display errors like that to the user as it is confusing. (Also by hiding errors you do get a little security by obscurity.) This is from php.ini:

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
display_errors = Off

; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below. While errors should not be displayed on productions
; servers they should still be monitored and logging is a great way to do that.
log_errors = On
+2 votes
by
OK. Q2A 1.6 will hide the error from public view and (as in previous versions) log it via PHP's error_log() function.
...