Hi!
I'm using Nginx with PHP-FPM to keep my Piwik installation in a chrooted environment. I'd like to use the "LOAD DATA INFILE" feature because the normal archiving methods are way too slow for processing my > 700.000 daily visits. I used Apache2, but today I moved to Nginx and stumbled over this problem:
I already figured out the cause:
My Piwik installation is stored in
So the CSV file is stored here:
PHP is chrooted to this directory:
The CSV file is successfully generated, but when Piwik advises MySQL to load the file, it sends the chrooted and not the real path.
As a workaround, I modified "core/Db/BatchInsert.php" and changed the following line:
By doing so, Piwik creates the CSV file like it always does, but provides MySQL with the non-chrooted path.
My question is: Does someone had the same problem and found a better way to handle this without modifying the code?
I don't want to keep this workaround, because I don't want to "repair" this line after every update.
Would it be worth to open a request for enhancement to add a config option for chrooted environments or absolute paths?
Cheers,
Thomas
I'm using Nginx with PHP-FPM to keep my Piwik installation in a chrooted environment. I'd like to use the "LOAD DATA INFILE" feature because the normal archiving methods are way too slow for processing my > 700.000 daily visits. I used Apache2, but today I moved to Nginx and stumbled over this problem:
Try #1: LOAD DATA INFILE : SQLSTATE[HY000]: General error: 13 Can't get stat of '/web/tmp/assets/piwik_option-bacca2a4e382aafddbd4e02d4cef7617.csv' (Errcode: 2)
I already figured out the cause:
My Piwik installation is stored in
"/srv/www/web/sites/domainxy/data/web"
So the CSV file is stored here:
"/srv/www/web/sites/domainxy/data/web/tmp/assets/piwik_option-bacca2a4e382aafddbd4e02d4cef7617.csv"
PHP is chrooted to this directory:
"/srv/www/web/sites/domainxy/data"
The CSV file is successfully generated, but when Piwik advises MySQL to load the file, it sends the chrooted and not the real path.
As a workaround, I modified "core/Db/BatchInsert.php" and changed the following line:
//$rc = self::createTableFromCSVFile($tableName, $fields, $filePath, $fileSpec); $rc = self::createTableFromCSVFile($tableName, $fields, '/srv/www/web/sites/domainxy/data/' . $filePath, $fileSpec);
By doing so, Piwik creates the CSV file like it always does, but provides MySQL with the non-chrooted path.
My question is: Does someone had the same problem and found a better way to handle this without modifying the code?
I don't want to keep this workaround, because I don't want to "repair" this line after every update.
Would it be worth to open a request for enhancement to add a config option for chrooted environments or absolute paths?
Cheers,
Thomas