PHP Crashes under Slight Load in Piwigo

I am hosting a Piwigo (PHP image gallery) site on Caddy. - https://icgallery.flexstart.me/

Ubuntu 16.04
512 MB RAM
Caddy version: 0.9.3
Piwigo version: 2.8.3
PHP version: 7.0.8-0ubuntu0.16.04.3
MySQL version: 5.7.16-0ubuntu0.16.04.1

It works very well. Until you start clicking around a lot. Then it throws an error message.

Any page on the site that you try to visit gives the same error. After a few minutes, everything automatically goes back to normal.

A look into the error log shows

03/Dec/2016:02:40:24 +0000 [ERROR 0 /i.php] PHP message: PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php on line 67
PHP message: PHP Warning:  mysqli::set_charset(): Couldn't fetch mysqli in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php on line 103
PHP message: PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php on line 147
PHP message: PHP Warning:  my_error(): Couldn't fetch mysqli in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php on line 837
PHP message: PHP Warning:  my_error(): Couldn't fetch mysqli in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php on line 837
PHP message: PHP Warning:  [mysql error ] 
SELECT value FROM piwigo_config WHERE param='derivatives' in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php on line 845
PHP message: PHP Fatal error:  Uncaught Error: Call to a member function fetch_row() on null in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php:231
Stack trace:
#0 /var/www/gallery.millhousenchurch.com/i.php(404): pwg_db_fetch_row(NULL)
#1 {main}
thrown in /var/www/gallery.millhousenchurch.com/include/dblayer/functions_mysqli.inc.php on line 231

Here is the block of config in my Caddyfile relevant to the site

https://icgallery.flexstart.me {
    root /var/www/gallery.millhousenchurch.com
    gzip
    minify
    tls *****@****** {
    protocols tls1.0 tls1.2
    }
    log /var/www/logs/millhousenchurch-gallery.log
    errors {
    log /var/www/logs/millhousenchurch-gallery-error.log
    404 /errors/404.html
    }
    header / {
    Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    Public-Key-Pins "pin-sha256=\"Vjs8r4z+80wjNcr1YKepWQboSIRi63WsWXhIMN+eWys=\"; pin-sha256=\"C5+lpZ7tcVwmwQIMcRtPbsQtWLABXhQzejna0wHFr8M=\"; pi$
    X-Frame-Options "SAMEORIGIN"
    X-XSS-Protection "1; mode=block"
    X-Content-Type-Options "nosniff"
    }
    fastcgi / /var/run/php/php7.0-fpm.sock php
}

Here is the thread I starting on the Piwigo forum: PHP MySQLi Error | Piwigo.org
Any assistance would be greatly appreciated!

That looks like a malfunction in your PHP/MySQL setup, nothing to do with Caddy.

I found the issue. I’ve been running out of RAM!

When you’ve only got 512MB to work with, swap is your friend! :smiley:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.