Support » Plugin: SQLite Integration » Need respect wp-config.php

  • Resolved Duong



    Thanks you for this plugin.

    I use NGINX 1.5.11, sqlite-integration 1.5.1, Sqlite3.8.4.1, PHP-FPM 5.5.9, Xcache 3.1

    I have an issue when use custom WP_PLUGIN_URL, DISALLOW_FILE_EDIT, DISALLOW_FILE_MODS in wp-config.php.

    The plugin don’t refer to there variables in sqlite-integration.php

    Other problems:
    – Slow down 30ms per request when use with this plugin (enable only variable )

    – Very slow when post comments. wp-comments-post.php response 300ms with Mariadb10 and 1.5 seconnds with sqlite.

    – Show warnning when enable WP debug mode:
    Strict Standards: Declaration of PDODB::db_connect() should be compatible with wpdb::db_connect($allow_bail = true) in …/plugins/sqlite-integration/pdodb.class.php on line 0

    Please continue update this plugin for WP 3.9 (now use mysqli)

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author kjmtsh


    Hi, Duong

    Thank you for your reporting.

    Xcache 3.1

    Please read readme.txt. This plugin doesn’t support caching plugins. They may cause problems or damage the proper functionality at the worst. I can’t help it, and caching plugins developers can’t help it, either. If you must use caching plugins, I recommend you to use MySQL.

    I have an issue when use custom WP_PLUGIN_URL, DISALLOW_FILE_EDIT, DISALLOW_FILE_MODS in wp-config.php.

    DISALLOW_FILE_EDIT and DISALLOW_FILE_MODS are features of WordPress, not the plugins’. And they work fine on my environment (WordPress 3.9 beta 2 with sqlite). I recommend you to check if your WordPress installation is complete. I think none of the plugins refer to these two constants in their codes, because there’s nothing to do on the plugin’s side.

    As for WP_PLUGIN_URL, this plugin does ignore it. Please use WP_PLUGIN_DIR instead. The reason is that reading files via http has some overheads and causes performance problem. Documents will include this instruction in the next version. Thank you for your advice.

    – Show warnning when enable WP debug mode:…

    I know this problem on WordPress beta version. This is not because WordPress 3.9 uses mysqli library but because the declaration of one function is changed and PHP doesn’t allow overloading the function like Java or C++. If I change this for 3.9 beta, the released version will give out warning instead. I recommend you to read pdodb.class.php and wp-includes/wp-db.php and compare them, and you’ll know what to do right away.

    WordPress 3.9 is not released yet, so they who use it will fix it easily, I guess. But the others who is using a released version now may not be used to programming PHP or may not be able to read warning message properly. I’m unwilling to fix this until WordPress 3.9 is released, though I’m ready to do it.

    Very slow when post comments…

    Oh… this is the first case. I’ll be glad if you let me know the details of it. What operations did you do? How did you measure the execution time?

    If you have time, please check again with the caching plugin deactived and cache data cleaned.



    For the WP_PLUGIN_URL:
    I use custom WP_CONTENT_URL :
    and WP_CONTENT_DIR is /www/

    So my WP_PLUGIN_URL will be:

    But your plugin still use /wp-content/plugins
    It will missing plugin JS, CSS
    I have to edit line 50 in sqlite-integration.php
    to: define('SQLiteUrl', WP_PLUGIN_URL . '/' . SQLiteDir);

    It will better security if the plugin check it “true” then not show the edit code:
    Edit Initial File (wp-content/db.php)

    For slow when posting comments:
    The respond time of wp-comments-post.php measured by Chrome Dev tool and disable all WP plugin. The ping from my location to my server is : 250ms. I use DigitalOcean hosting.

    I known sqlite slower when writing to DB file. The slow could not by your plugin, I will need more investigation.

    I have a question:
    How many times the database file is open/read (by php fopen) per request? It base on numbers of sql query ?

    Thanks for your support.

    Plugin Author kjmtsh


    Ah, I’ve got your point. You mean the admin utilities. I’ll make it so that the plugin refers to the constant and no one ever can edit db.php in the next release. But… the easiest way is this: remvoe sqlite-integration.php and utilities directory altogether from under sqlite-integration directory. This will make every person logged in, even an adminstrator included, unable to access the plugin files, and this doesn’t affect the database functionality at all.

    I tested the comment insert query on MySQL and SQLite. Below is the script for checking by using WordPress function wp_new_comment(). Some other functions are used in wp-comments-posts.php.

    function my_microtime() {
      return ceil(microtime(true) * 1000);
    $comment_data = array(
      'comment_post_ID'      => 1,
      'comment_type'         => 'comment',
      'comment_content'      => 'This is a test.',
      'comment_author'       => 'hoge',
      'comment_author_url    => '',
      'comment_author_email' => 'hoge@debian'
    $time_start    = my_microtime();
    $post          = get_post(1);
    $status        = get_post_status(1);
    $status_object = get_post_status_object($status);
    $comment_id    = wp_new_comment($coment_data);
    $comment       = get_comment($comment_id);
    $time_end      = my_microtime();
    $time          = $time_end - $time_start;
    echo $time . "\n";

    I checked with the script several times. First two times with “E-mail me whenever” option checked, and the others without checking that option, because email sending is a heavy work for PHP. The results are below:

    1. MySQL with WordPress 3.8.1
      • 264
      • 284
      • 57
      • 153
      • 58
      • 62
      • 79
      • 66
    2. SQLite with WordPress 3.8.1
      • 430
      • 351
      • 162
      • 156
      • 148
      • 144
      • 159
      • 144
    3. SQLite with WordPress 3.9 beta2
      • 612
      • 639
      • 163
      • 165
      • 173
      • 174
      • 172
      • 234
      • 158

    1.5 seconnds

    is abnormally slow indeed. I don’t understand the reason. WordPress used the queries below:

    1. SELECT * FROM wp_posts WHERE ID = 1 LIMIT 1;
    2. SELECT comment_ID FROM wp_comments WHERE comment_post_ID = 1 AND comment_parent = '0' AND comment_approved != 'trash' AND ( comment_author = 'hoge' OR comment_author_email = 'hoge@debian' ) AND comment_content = 'This is a test.' LIMIT 1;
    3. SELECT comment_date_gmt FROM wp_comments WHERE comment_date_gmt >= '2014-03-23 08:16:05' AND ( comment_author_IP = '' OR comment_author_email = 'hoge@debian' ) ORDER BY comment_date_gmt DESC LIMIT 1;
    4. SELECT option_value FROM wp_options WHERE option_name = 'moderation_keys' LIMIT 1;
    5. SELECT comment_approved FROM wp_comments WHERE comment_author = 'hoge' AND comment_author_email = 'hoge@debian' AND comment_approved = '1' LIMIT 1;
    6. SELECT option_value FROM wp_options WHERE option_name = 'blacklist_keys' LIMIT 1;
    7. INSERT INTO wp_comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_karma, comment_approved, comment_agent, comment_type, comment_parent, user_id) VALUES (1, 'hoge', 'hoge@debian', '', '', '2014-03-23 18:16:05', '2014-03-23 09:16:05', 'This is a test.', 0, '0', '', 'comment', 0, 0);
    8. SELECT * FROM wp_comments WHERE comment_ID = 9 LIMIT 1;

    If you are interested in genuine SQLite speed, try these SQLs in the for loop with $wpdb::query() method and measure the execution time on your environment.

    If you are interested in SQLite, visit SQLite org. You can read the documentation and download the source tree. I recommend you to begin the overviews and features and extensions, and read the source files. You’ll know all you want to know.


    I updated the plugin to latest version 1.6.

    I see a typo in utility.php line 955:

    About slow on comments:

    That is my mistake when configure NGINX. I had limit requests rate when post comment.

    I will follow some your suggest.
    Thanks you.

    Plugin Author kjmtsh



    Thank you for the reposrt, Duong. I’ll fix it in the next release.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need respect wp-config.php’ is closed to new replies.