Hosting piwik on a server with a read-only filesystem

I use CloudControl for hosting and I would like to set up a server (possibly with load balancing support) to host piwik for all of my websites. The only problem is that the only writable directory CloudControlled allows you to access is defined by $_SERVER['TMPDIR'].

Is it possible to modify piwik to use this directory for all of its file-writing needs?

And also will I run into any issues with using load balancing? Something like automatically generated reports being generated by each node behind my load balancer since they're not aware of each other?

-------------Problems Reply------------

The idea is to keep this change for your system even when you update.

This is easy to do: create a bootstrap.php inside the piwik main folder.

This is the content of said file:


You can double-check this: in index.php, you should see that it checks for a bootstrap.php file in the same folder. It's included when available, and this allows you to do little customizations and keep them even when you update. E.g. I've run piwik from svn for the past three years or so and have some custom changes in there.

There's far too much code for me to be able to confirm this works, but the constant PIWIK_USER_PATH seems to be used as the base root for file io. With that in mind, editing index.php, around line 23, which is originally:


To something like:


Might work - but then what happens when it's trying to read a file in its original location? Since this is a temporary directory, however, it may not be viable, in which case an approach using override_function or a similar method, paired with a persistent storage (your database), might also work - by overriding file functions with a database load/save routine; obviously this opens up another can of worms of biblical proportions, thus, my final recommendation is for you to get another less restrictive host.

Category:php Views:0 Time:2011-09-01

Related post

  • serve my text from the filesystem instead of a database? 2009-07-08

    I am working on a content management application in which the data being stored on the database is extremely generic. In this particular instance a container has many resources and those resources map to some kind of digital asset, whether that be a

  • How Do I Serve Files Direct From the FileSystem Using ASP.NET MVC 1.0? 2011-09-02

    I have an ASP.NET MVC 1.0 application running on Windows Server 2003 IIS 6.0. I just added a new feature that lets users upload files to the server. I also added a page that displays a list of the files uploaded by that user. The problem is when some

  • how to bind image that is saved in filestream database sql server 2008 to a image control 2010-01-06

    i have used filestream of sql server 2008 for storing images. i want to retrive that image and bind to image control.but not getting the correct path. please help. --------------Solutions------------- You could to write a page which: Receive that ima

  • Serving images through HTTP. Load balanced highly available architecture 2011-02-24

    I'm planning a system for serving image files from a server cluster with load-balancing. I'm battling with the architechture and whether to save the actual image files as blobs in the database or in filesystem. My problem is that, the database connec

  • Sql Server CLR file system access from UDF 2011-04-01

    I wrote a simple UDF that should plot a graphic and save it on disk. Actually, I am using an UDF as a proxy between SQL SERVER and R, so UDF only passes the R script to the R engine from SQL SERVER via DCOM. Everything works fine until I try to plot

  • Code sharing between server and client in Clojurescript/Clojure 2011-10-20

    Say I wanted to factor out some common code between my client-side *.cljs and my server-side *.clj, e.g. various data structures and common operations, can I do that ? Does it make sense to do it ? --------------Solutions------------- Great question!

  • Real Time Javascript Event Tracking (Javascript Stats) 2010-07-08

    There are lots of real time web stats services on the web (w3counter-histats-gostats).They just count once when page is requested , But what I want to do is track javascript functions/events, because my website is fully-ajax.So I want something like

  • How to Tuning Apache and Mysql 2011-04-08

    top - 12:24:22 up 1 day, 18:37, 2 users, load average: 1.19, 1.77, 1.59 Tasks: 166 total, 4 running, 162 sleeping, 0 stopped, 0 zombie Cpu(s): 20.1%us, 5.8%sy, 0.0%ni, 62.4%id, 10.8%wa, 0.0%hi, 1.0%si, 0.0%st Mem: 987780k total, 979052k used, 8728k f

  • How do I create a sparse file programmatically, in C, on Mac OS X? 2008-10-09

    I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible? --------------Solutions------------- As in other Unixes, it's a feature of the filesystem. Either the filesystem su

  • Keeping a variable around from post to get? 2008-12-11

    I have a class called myClass which defines post() and get() methods. From index.html, I have a form with an action that calls which grabs some data from the data base, sets a couple variables and sends the user to new.html. now, new.h

  • Encrypting web.config using Protected Configuration pointless? 2009-03-25

    I must be missing something... So I am in the process of figuring out the best way of encrypting the database connection string and sql session state connection info in web.config. I quickly find a walk through on msdn explaining using protected conf

  • Rails: Storing binary files in database 2009-04-09

    Using Rails, is there a reason why I should store attachments (could be a file of any time), in the filesystem instead of in the database? The database seems simpler to me, no need to worry about filesystem paths, structure, etc., you just look in yo

  • "Unable to complete network request" or "connection rejected" for Firebird, on just one machine 2009-04-13

    I've got a seemingly unique issue on just one computer in the company (had to be my boss's). I've got a program from Borland C++ that uses a TSQLConnection. It connects to a local Firebird server running as an application. The other compu

  • can a web parser differentiate between static and dynamic text? 2009-06-26

    Can a web parser differentiate between static and dynamic text on a webpage? For example there is a string on a webpage Hello "Fantastic Four" In this "Hello" is a static data and "Fantastic Four" is a dynamic data (say being populated form a databas

  • Compile C++ over FTP 2009-08-02

    I would like to know if I can use g++ to compile C++ source files stored on an FTP server? Can this be done? Thanks NOTE: The FTP server is within the local network --------------Solutions------------- No, this is not possible. Ftp doesn't allow you

  • URL: Directory like or Pages with extension 2009-08-21

    If you look at the url of the you can see that the url is like: or or some very

  • Can I "disable" git-clone over http? 2009-08-28

    I'm using git to manage a tiny project. I've been performing all of my transactions (clone, push, pull, etc) through SSH, but recently ran git-update-server-info because I wanted to experiment with running git-clone over http. It worked great. Cool.

  • Absolute Relative path issues in referenceing web assets - need help - php related 2009-10-07

    Hi guys I'm in a bit of a pickle here now. Well to start with I built a simple CMS in PHP with an admin panel the directory structure is like this: root/ ->admin/ ->images/ It worked fine as is however the client requirements changed and they w

  • How can I speed up image load time in my web site? 2009-10-13

    I am currently developing a web site with PHP + MySQL and jQuery. So far I have been doing it in my local machine. I notice that when I see the page the images on it take some time to load (few time but its visible). All images are small (PNG's with

Copyright (C), All Rights Reserved.

processed in 0.155 (s). 11 q(s)