• Resolved islp

    (@islp)


    Hello, a <span style=”text-decoration: underline;”>silly</span> question:

    my wp_config file is outside the root (one level up) and I used the suggested code to move the sqlite file from the wp_content directory:

    define(‘WP_SQLITE_OBJECT_CACHE_DB_FILE’, ‘/tmp/obj-cache.sqlite’);
    define(‘WP_CACHE_KEY_SALT’, ‘btirduemnp’);

    Problem is, now I can’t find the file nor the directory, but it looks like the plugin is working.

    I searched in the plugin directory but I couldn’t find it, I don’t understand where it is storing the data. Can you help me?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author OllieJones

    (@olliejones)

    On Linux and other UNIX-derived systems with the systemd system-service manager, your web server process is started with the PrivateTmp=true setting. This means that the system creates a subdirectory under /tmp to hold your /tmp files. On my Ubuntu 20.04 system that directory’s name is

    /tmp/systemd-private-cafedeadbeef457285028e81df595eec-apache2.service-secret/tmp

    You’ll find your .sqlite file there. This is a really good OS security measure. Read about it here. https://systemd.io/TEMPORARY_DIRECTORIES/

    • This reply was modified 1 year, 7 months ago by OllieJones.
    Thread Starter islp

    (@islp)

    Ok, problem is probably I can’t access that directory in a shared hosting environment: neither FTP nor SSH let me access.

    Thanks, anyway. ??

    I believe using /tmp is not mandatory. Any other dir outside of your publicly hosted website is fine as well. Have you thought about making a folder in your home directory, such as ~/cache, and storing the SQLite file there instead?

    Thread Starter islp

    (@islp)

    @eriky82 Of course, I thought about that, but then I thought: do I really need to see what’s going on with the SQLite file? The plugin does anything I need (eg. it can remove the file too). So, I don’t have to worry about anything. ??

    True! Perhaps you may still consider it because you have no idea how your hoster treats /tmp

    E.g., perhaps they clean the dir every hour or something like that.

    Thread Starter islp

    (@islp)

    @eriky82 They don’t: the plugin features a “cache size” setting: when the cache grows larger than the value the user inserts, an hourly cleanup removes the oldest entries. I found this is true, the file is never completely erased, unless I intentionally flush the cache. ??

    Thread Starter islp

    (@islp)

    Even if FTP/SSH don’t let you access the temp directory, of course you can use simple PHP to check its content:

    $temp_dir = sys_get_temp_dir();

    // here I found the sqlite file is at index 0
    $files = scandir($temp_dir, SCANDIR_SORT_DESCENDING);

    // file size, eg. 8437760 bytes
    echo(filesize($temp_dir. “/” .$files[0]))

    Plugin Author OllieJones

    (@olliejones)

    Clearing the /tmp folder of active files every hour would seriously disrupt server operations; your hosting people surely don’t do that. If the SQLite file is, for some reason, deleted the plugin re-creates it. It’s a cache and contains nothing except ephemeral data.

    You can put the SQLite file in public_html or some other directory, as well as in /tmp.

    And, in normal operations you don’t need to access it except via the plugin.

    • This reply was modified 1 year, 6 months ago by OllieJones.
    Thread Starter islp

    (@islp)

    @olliejones It’s absolutely fine the /tmp directory ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Moving to /tmp’ is closed to new replies.