SQLite Integration plugin

Home Forums BulletProof Security Free SQLite Integration plugin

This topic contains 15 replies, has 2 voices, and was last updated by  sb 4 years, 9 months ago.

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #9456

    sb
    Participant

    Hello,

    I have a Pogoplug that I’ve re-purposed to host a modest, family-access-only WordPress blog. I originally used Apache, MariaDB (MySQL), and PHP  (running on Arch Linux ARM) for the site.  BPS worked fine in this setup. Today, I replaced Apache with nginx, and I replaced MySQL with SQLite (in conjunction with the “SQLite Integration” WP plugin). In the end, my performance didn’t improve much, but my resource usage is about a third of what is was. (I’ve only got 256Mb of memory to work with, so this is a great improvement!) But there’s a problem: BPS doesn’t seem to like the new setup.  It runs and doesn’t complain, but the interface seems (partially) broken: htaccess Core menu

    1. Blue tabs are now a list of blue rows
    2. Security Modes, Security Status, Security Log, and System Info “buttons” (now blues rows) still work, but they simply scroll down further in the same page, and formatting is mostly lost.
    3. None of the other blue “buttons” work
    Login Security menu
    1. Appears to be 100% functional.  It was not impacted by the change.
    I suspect SQLite is the problem,  not nginx, but that’s just a hunch. Has anyone had success running BPS on SQLite using the SQLite Integration plugin (Or by any means)? I will not give up BPS!  If I have to revert to my old setup to keep BPS, I will (but I’d rather not!).

    Thanks for your help!
    steady

    #9457

    AITpro Admin
    Keymaster

    Try deleting your root and wp-admin .htaccess files first.  If the problem goes away then this is a Nginx/.htaccess file issue.

    General FAQ Info on Nginx.  We have not done a lot of testing with Nginx, but it if you have pure Nginx without Apache then there is most likely going to be an .htaccess Rewrite issue.

    Compatible with Nginx frontend Server with Apache backend Server

    Does BulletProof Security Work on ALL Nginx Servers / Server Configurations?

    If you are using both Apache and Nginx together and Nginx is the frontend webserver and Apache is the backend Server used to process PHP then BulletProof Security will work on this type of combined Server Configuration. If you are only using Nginx then an .htaccess file will not work. Nginx has its own rewrite module – HttpRewriteModule and the mod_rewrite equivalent of an .htaccess file has similar, but different coding and is added to an Nginx Server config file. Note: If you are not familiar with Nginx, then it should be noted that Nginx does not have a PHP module like Apache’s mod_php, instead you either need to build PHP with FPM (ie: php-fpm/fastcgi), or you need to pass the request to something that can handle PHP.

    Possible MySQL issue.  This code in the /bulletproof-security/admin/options.php file may be a problem.  At some point we need to change/get rid of mysql_get_client_info() since it has been deprecated as of PHP 5.5.0, and will be removed in the future.

    Try commenting this code out below in the options.php file by wrapping it with /*  the code */ to comment it out.

    echo __('MySQL Database Version', 'bulletproof-security').': ';
    $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
    echo '<strong>'.$sqlversion.'</strong><br>';
    echo __('MySQL Client Version', 'bulletproof-security').': <strong>'.mysql_get_client_info().'</strong><br>';
    echo __('Database Host', 'bulletproof-security').': <strong>'.DB_HOST.'</strong><br>';
    echo __('Database Name', 'bulletproof-security').': <strong>'.DB_NAME.'</strong><br>';
    echo __('Database User', 'bulletproof-security').': <strong>'.DB_USER.'</strong><br>';
    echo __('SQL Mode', 'bulletproof-security').': ';
    
    $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
    if (is_array($mysqlinfo)) {
    $sql_mode = $mysqlinfo[0]->Value;
    if (empty($sql_mode)) {
    $sql_mode = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
    } else {
    $sql_mode = '<strong>'.__('Off', 'bulletproof-security').'</strong>';
    }}
    echo $sql_mode;
    echo '<br><br>';
    #9479

    sb
    Participant

    Thank you for your speedy reply; sorry for the delay in mine: I commented out the block of code in the options.php file, and that solved the problem. (Also, deleting the .htaccess files had no effect on the problem.)

    Thank you!
    steady

    #9480

    AITpro Admin
    Keymaster

    Great!  That means that there is not a problem with the .htaccess files and this issue is just simply that that particular php function does not work with SQLite as I suspected.  So what I will need to figure out is an SQLite condition that I can check for that would indicate SQLite is being used vs MySQL.  Note:  The next versions of BPS will be using mysqli_get_client_info() instead of mysql_get_client_info().

    Example:  If SQLite do X.  If MySQL do Y.

    #9481

    AITpro Admin
    Keymaster

    Actually if you would test adding this function exists code to see if this solves that problem that would be great.  Make sure you add the closing curly bracket highlighted in yellow below at the end of the code.

    if (function_exists(‘mysql_get_client_info’)) {

    echo __('MySQL Database Version', 'bulletproof-security').': ';
    $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
    echo '<strong>'.$sqlversion.'</strong><br>';
    echo __('MySQL Client Version', 'bulletproof-security').': <strong>'.mysql_get_client_info().'</strong><br>';
    echo __('Database Host', 'bulletproof-security').': <strong>'.DB_HOST.'</strong><br>';
    echo __('Database Name', 'bulletproof-security').': <strong>'.DB_NAME.'</strong><br>';
    echo __('Database User', 'bulletproof-security').': <strong>'.DB_USER.'</strong><br>';
    echo __('SQL Mode', 'bulletproof-security').': ';
    
    $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
    if (is_array($mysqlinfo)) {
    $sql_mode = $mysqlinfo[0]->Value;
    if (empty($sql_mode)) {
    $sql_mode = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
    } else {
    $sql_mode = '<strong>'.__('Off', 'bulletproof-security').'</strong>';
    }}
    echo $sql_mode;
    echo '<br><br>';

    }

    #9482

    sb
    Participant

    I’d be happy to test the function.  It will be this evening before I can get to my hardware to try it, though. Background: the plugin I’m running that allows me to use SQLite instead of MySQL says the following:

    SQLite Integration is a kind of wrapper program, which is placed between WordPress and SQLite database and works as a mediator. It works as follows:

    1. Intercepts the SQL statement for MySQL from WordPress
    2. Rewrites it for SQLite to execute
    3. Give it to SQLite
    4. Gets the results from SQLite
    5. Formats the results as WordPress wants, if necessary
    6. Give the results back to WordPress

    WordPress thinks she talks with MySQL and doesn’t know what has happened in the background. She really talks with SQLite and will be happy with it.

    Based on this, I wonder if the plugin will expose enough to the function to know if MySQL isn’t present.  Regardless, I’ll give it a shot!

    Thanks again,
    steady

    #9504

    sb
    Participant

    The function did not work, so I just went back to the block comment solution, and all is well. The SQLite Integration plugin, I believe, assures that the system “sees” MySQL despite its not being there.  Regardless, I’m happy with your block comment solution.

    Thanks again for your help!
    steady

    #9986

    sb
    Participant

    Hello,

    Well I updated my BPS installation today, and the “fix” (commenting out the block in the options.php) no longer works.  (Apparently, the options.php was overwritten during the update, so I applied the”fix” to the new options.php file.

    I believe this problem results from my using SQLite in place of MySQL.  The resulting wound to BPS _appears_ to be BPS GUI only, as I’ve not noticed re-write problems caused by niginx to date.  Is there a workaround that will allow me access all the BPS “blue tabs”?  Still a little confused why the “fix” isn’t working with the BPS update–the code I commented out looks identical to the previous version.

    Thanks so much for your help!
    steady

    #9987

    AITpro Admin
    Keymaster

    During WordPress plugin upgrades all of the old plugin files are deleted and new plugin files are created.  The same commenting out fix should work, but there was a slight change to the code.  You will need comment out a couple of additional lines of code.

    /*
    echo __('MySQL Database Version', 'bulletproof-security').': ';
    $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
    echo '<strong>'.$sqlversion.'</strong><br>';
    echo __('MySQL Client Version', 'bulletproof-security').': <strong>'.mysqli_get_client_info().'</strong><br>';
    echo __('Database Host', 'bulletproof-security').': <strong>'.DB_HOST.'</strong><br>';
    echo __('Database Name', 'bulletproof-security').': <strong>'.DB_NAME.'</strong><br>';
    echo __('Database User', 'bulletproof-security').': <strong>'.DB_USER.'</strong><br>';
    echo __('SQL Mode', 'bulletproof-security').': ';
    
    $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
    if (is_array($mysqlinfo)) {
    $sql_mode = $mysqlinfo[0]->Value;
    if (empty($sql_mode)) {
    $sql_mode = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
    } else {
    $sql_mode = '<strong>'.__('Off', 'bulletproof-security').'</strong>';
    }}
    echo $sql_mode;
    echo '<br><br>';
    */
    #9989

    sb
    Participant

    Hello,

    I commented it out as you instructed above, however, this time it’s not fixing the problem: the BPS Blue Tabs are blue rows, and only the first four (approx) have functional links. Also, I updated the SQLite Integration plugin as well (the plugin that allows WP to work without MySQL, but not necessarily WP plugins!), and that plug-in update may have broken this.  Thanks for your help, and sorry for the trouble.

    steady

    #9991

    AITpro Admin
    Keymaster

    Right mouse click on the BPS htaccess Core page, click View Source and copy and paste the last few lines of code that you see in the Source code of the page.

    #9992

    sb
    Participant

    Sir,

    Please pardon my recent incompetence. The fix is still working. Somehow I didn’t get the “fixed” option.php in the proper folder. Thank you for sticking with me, sorry for the wild goose chase.

    steady

    #9995

    AITpro Admin
    Keymaster

    It happens. 😉  Thanks for confirming the fix still works.

    #10145

    sb
    Participant

    Regarding your comment in a previous post:

    During WordPress plugin upgrades all of the old plugin files are deleted and new plugin files are created.

    I just started using the Notes field in BPS, to record file permission settings, since a few of the BPS-recommended settings cause my site to not work. Are my BPS Notes retained during the upgrade process?  My Custom code survived the upgrade, so I suspect my Notes will as well, but I don’t want to find out the hard way that I made a bad assumption.  😉

    steady

    #10148

    AITpro Admin
    Keymaster

    Yes, Notes and Custom Code code and text is saved to your WordPress Database so it is NOT removed during a BPS upgrade.  Only files are deleted and added during WordPress plugin or theme upgrades.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.