Error 500

I have 2 installations in the same url and different paths. One for testing (with own database table) and one for "usage" (with own database table).
Both installations should contain the same files :D I say on purpose "should"!

Some minute ago I was purging the caches (image/rss/html/search) of both installations.
The "test" version works still fine.
While the "usage" version shows a blank page.

error.log just says: 500

debug.log shows:
USER ERROR: MySQLi Error: ( SELECT DISTINCT id FROM [prefix]images WHERE show = 0 OR albumid in () ) failed. MySQLi returned the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 in /var/www/my_zpc/com/zp-core/functions-db-MySQLi.php on line 78
trigger_error called from query (functions-db-MySQLi.php [78])
from getNotViewableImages (functions.php [1568])
from getTagCountByAccess (functions.php [1191])
from getAllTagsUnique (functions.php [1116])
from tagSuggestJS (tag_suggest.php [64])
from tagSuggestJS_frontend (tag_suggest.php [50])
from call_user_func_array (unknown)
from zp_apply_filter (functions-filter.php [149])
from include (inc-header.php [37])
from include (index.php [1])
from include (index.php [130])
from index.php [31]

Then I overwrote functions-db-MySQLi.php by copy and pasting it from the test install. But no change.

But the "usage" installation can be accessed with my working browser where I am working as ZenPhoto-Admin and the page works all normal.

Any idea because this is really strange to me.

Comments

  • acrylian Administrator, Developer

    What page exactly did this happen? And does it happen frequently? Sometimes there are glitches that happen one time and strangely not again…

  • It is the first time that I see such behaviour.

    It happens with all "usage" = live pages.

    What/how I did it:
    First after purging caches I just pressed F5 to refresh (in another browser ) the current picture album. In return I got a blank page.

    I took my "admin browser" - where the front- and backend still work normal - and walked throught all the albums to generate the thumbnails and open all existing pictures.
    (As the pages are still not available for public and there are not many albums and pictures imported, it takes no time to open all that.)

  • acrylian Administrator, Developer

    Did you try to clear the browser cache? Sometimes this is a bit too persistent and causes all sorts of fun by requesting an old page version.

    Always try a standard theme, too.

  • Nordlicht Member
    edited January 2019

    Ctrl+U shows this:

    <!DOCTYPE html>
    meta charset="UTF-8">
    script type="text/javascript" src="/com/zp-core/js/jquery.js">
    script type="text/javascript" src="/com/zp-core/js/encoder.js">/script>
    script type="text/javascript" src="/com/zp-core/js/tag.js">/script>
    link type="text/css" rel="stylesheet" href="/com/zp-core/zp-extensions/tag_suggest/tag.css">
    /head>body>/body>/html

    I now installed and activated the theme "Zenpage".
    My "admin-browser" displays the page with the new layout.

    Another browser still displays a blank page.
    Meanwhile I tried 4 different browsers (FF, Opera, IE and QupZilla) on 2 other machines.
    All with the same result.

  • Sorry, I was looking in the wrong error.log

    When accessing the page with another browser it will cause this error.log entry:

    PHP Fatal error: MySQLi Error: ( SELECT DISTINCT id FROM [prefix]images WHERE show = 0 OR albumid in () ) failed. MySQLi returned the error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 in /var/www/my_zpc/com/zp-core/functions-db-MySQLi.php on line 78

    In the access.log I can find following entries:
    "GET /com/ HTTP/1.1" 500 197 "-"
    "GET /com/zp-core/zp-extensions/tag_suggest/tag.css HTTP/1.1" 200 251 "https:// my_zpc/com/"
    "GET /favicon.ico HTTP/1.1" 200 4286 "-"
    "GET /com/ HTTP/1.1" 500 197 "-"
    "GET /com/zp-core/zp-extensions/tag_suggest/tag.css HTTP/1.1" 304 - "https:// my_zpc/com/"
    "GET /com/zp-core/js/encoder.js HTTP/1.1" 200 3446 "https:// my_zpc/com/"
    "GET /com/zp-core/js/jquery.js HTTP/1.1" 200 33369 "https:// my_zpc/com/"
    "GET /com/zp-core/js/tag.js HTTP/1.1" 200 2739 "https:// my_zpc/com/"

  • acrylian Administrator, Developer

    Do you have the html static cache enabled? Perhaps it did cache the broken page and therefore serves the blank page? Loggedin admins don't get the html cache.

    The only thing in that query that looks weird is OR albumid in () ) since there should be in() and there should be some id probably. In any case it seems to be related to the tagsuggest plugin. So try to disable that. This is a older plugin and never cause these trouble to my knowledge (we even use it ourselves on our site).

  • I deactivated tagsuggest.
    Purged all caches again.
    Started Tor-Browser (to be sure I have a clean browser and different IP)
    opened the page - AND believe what: :D
    The website is showing now!

    I tried all other browsers - and it is rocking again! :smiley:

    Thanks for your assistance!!

  • "Do you have the html static cache enabled?"

    Is this a plugin?
    Can't find it in my install.

  • acrylian Administrator, Developer
    edited January 2019

    Good, it worked again. The actual query error is related to a helper function named getNotViewableImages() which sorts out tags from images that are not viewable/not allowed for the current visitor. Reason is if there is an image/album with a unique tag it does not make sense to suggest this tag if the vistor cannot view the connected item anyway.
    This however is a bit costly regarding performance since it needs to scan everything first to sort out which is why there is an option to disable this check. Please try to enable tag_suggest and disable that option.

    And yes, html_static_cache is an offiicial plugin included for years already ;-) It just caches pages so it "might" that it accidentally caches a wrong result (not knowing what it caches). However that does relate to fatal errors since it just cachces the html result.

  • And once again -> Thanks for your support!

    So this means that, if I would have logged in as admin in one of the other browsers, I would have seen the frontend as well. (BE was reachable during all this time with any other of the browsers.)

  • acrylian Administrator, Developer

    Can't say what went wrong exactly, but standard is full admin always sees everything on the frontend that normal users or loggedin users with lower rights will not see (see the user guide). So he can preview.

Sign In or Register to comment.