Title: Readonly Table Error
Last modified: December 19, 2017

---

# Readonly Table Error

 *  [unkfrank](https://wordpress.org/support/users/unkfrank/)
 * (@unkfrank)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/)
 * Hi all
    Looks like a great plugin but I have one problem. I have installed it
   on one site. It seems to work correctly. I’ve exported the settings, installed
   it on another and imported the settings. On the new site I get this error when
   accessing the Logs page with live update:
 * class-ip-geo-block-logs.php(675) SQLSTATE[HY000]: General error: 8 attempt to
   write a readonly database
 * Any suggestions?
    Thanks in advance, Frank

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9796166)
 * Hi Frank,
 * Sorry for the issue, but it is related to “**Live update**” in Logs tab. It uses
   SQLite and makes database in your temporal directory which is derived from [get_temp_dir()](https://developer.wordpress.org/reference/functions/get_temp_dir/).
   For some details, please refer to [3.0.5 Release Note](http://www.ipgeoblock.com/changelog/release-3.0.5.html).
 * Unfortunately, I’m not sure if the following steps would resolve the issue or
   not, but please try.
 * 1. Add `define( 'IP_GEO_BLOCK_DEBUG', true );` into your wp-config.php
    2. Go
   to the Settings tab of IP Geo Block. Then you’ll find “**Reset database source
   of “Live update”**” in “**Statistics and Logs settings**” section. 3. Click the
   button to remove the SQLite database file.
 * ![Reset database](https://i0.wp.com/user-images.githubusercontent.com/828814/
   34160438-59035ae2-e510-11e7-8a6d-52b9eb296b9a.png?ssl=1)
 * If you still have the same error after you do the above, I provide another possible
   solution using [`ip-geo-block-live-log`](http://www.ipgeoblock.com/codex/ip-geo-block-live-log.html)
   filter hook to specify the full path to the database file manually.
 * But please try the reset button at first.
 * Thank you for your cooperation.
 *  Thread Starter [unkfrank](https://wordpress.org/support/users/unkfrank/)
 * (@unkfrank)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9796241)
 * Hi tokkonopapa
    Tried your first suggestion. That resulted in a white screen 
   only when refreshing the admin area…? For the second part, Reset SQLite, I don’t
   find that option anywhere on the settings page. Installed version is 3.0.5. Any
   other suggestions? Thanks for the plugin and your help. Frank
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9796474)
 * Hi Frank,
 * > Tried your first suggestion. That resulted in a white screen only when refreshing
   > the admin area…?
 * Have you recover your admin area? Please revise your wp-config.php as before.
 * > For the second part, Reset SQLite, I don’t find that option anywhere on the
   > settings page.
 * You might failed to define the symbol `IP_GEO_BLOCK_DEBUG` to `true`.
 * OK, then let’s try another.
 * I assume that you can use FTP.
 * 1. Please find “/wp-content/ip-geo-api/” or “/wp-content/uploads/ip-geo-api/`
   directory.
 * 2. In the above directory, you can find “drop-in-sample.php”.
 * 3. Edit the “drop-in-sample.php” to uncomment the line of defining `IP_GEO_BLOCK_DEBUG`
   using proper text editor ([https://codex.wordpress.org/Editing_Files#Using_Text_Editors](https://codex.wordpress.org/Editing_Files#Using_Text_Editors))
   as follows:
 *     ```
       /**
        * Enables some debug features on dashboard
        *
        */
       define( 'IP_GEO_BLOCK_DEBUG', true );
       ```
   
 * 4. Save it as “drop-in.php” and put it into the same directory. Then you’ll find
   the “Reset now” button for SQLite.
 *  Thread Starter [unkfrank](https://wordpress.org/support/users/unkfrank/)
 * (@unkfrank)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9796534)
 * Hi tokkonopapa
    Admin area is back since I removed that line. Uncommented that
   line and now find the reset now button. Pressed button. Go to “Logs” page. 10
   or so IP addresses are now listed in red. If I check the Live Uodate box and 
   then click the arrow button to start I get this error:
 * /home/buycape/public_html/wp-content/plugins/ip-geo-block/classes/class-ip-geo-
   block-logs.php(675) SQLSTATE[HY000]: General error: 8 attempt to write a readonly
   database
 * and no IP’s show up in the list.
    Any other ideas? Thanks again, Frank
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9796604)
 * Hi Frank,
 * OK…
 * Could you click “<b>Show information</b>” button at the bottom of “**Plugin settings**”
   section?
 * And please let me know what “File system” says. Mine is as follows:
 *     ```
       - Server: Apache
       - PHP: 7.1.8
       - WordPress: 4.9.1
       - Multisite: no
       - File system: direct <== THIS ONE!!
       - Zlib: yes
       - ZipArchive: yes
       - BC Math: yes
       - mb_strcut: yes
       - SQLite(PDO): yes
       - DNS lookup: available [523.2 msec]
       - Twenty Seventeen Child 1.0
       - Twenty Seventeen 1.4
       - IP Geo Block 3.0.6a
       - WP Multibyte Patch 2.8.1
       ```
   
 * And I’m sorry but my time is mid-night. So I have to go to bed. I’ll give you
   some suggestion tomorrow.
 * If you do not enable “Live update” on Logs tab, the error would not happen. So
   please keep using my plugin.
 * Thank you for your cooperation! Good night!!
 *  Thread Starter [unkfrank](https://wordpress.org/support/users/unkfrank/)
 * (@unkfrank)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9796605)
 * I see the problem editing the wp-config.php file. I copied your code from an 
   email. It seems to have added some hex code. Here’s the way it came out:
 * define( 'IP_GEO_BLOCK_DEBUG', true );
 * Looking at your message above, it should be:
 * define( ‘IP_GEO_BLOCK_DEBUG’, true );
 * Is it better to leave it in the file within your directory or put it in the wp-
   config file??
 *  Thread Starter [unkfrank](https://wordpress.org/support/users/unkfrank/)
 * (@unkfrank)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9796770)
 * Thanks, have a good night…
 * – Server: Apache
    – PHP: 5.6.32 – WordPress: 4.9.1 – Multisite: no – File system:
   direct – Zlib: yes – ZipArchive: yes – BC Math: gmp yes – mb_strcut: yes – SQLite(
   PDO): yes – DNS lookup: available [103.4 msec] – Child Theme 3.0.27.1484226135–
   Divi 3.0.92 – Akismet Anti-Spam 4.0.2 – All-in-One WP Migration 6.61 – All-in-
   One WP Migration Unlimited Extension 2.12 – Bulk Page Creator 1.1.0 – Child Theme
   Configurator 2.2.8.1 – Cloudflare 3.3.2 – Duplicator 1.2.30 – Easy Property Listings
   3.1.19 – Elegant Themes Updater 1.0 – Google Analytics Dashboard for WP (GADWP)
   5.1.2.4 – Gravity Forms 2.2.5 – Gravity Forms CSS Ready Class Selector 1.1 – 
   Heartbeat Control 1.2.2 – InfiniteWP – Client 1.6.8.1 – IP Geo Block 3.0.5 – 
   Media Library Assistant 2.65 – SSL Insecure Content Fixer 2.5.0 – Sucuri Security–
   Auditing, Malware Scanner and Hardening 1.8.11 – UpdraftPlus – Backup/Restore
   2.14.1.22 – User Role Editor 4.39 – Wordfence Security 6.3.22 – WP-Optimize 2.1.1–
   WP Import 2.0.1.5 – WP Smush 2.7.6 – Yoast SEO 5.9.3
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9799742)
 * Hi Frank,
 * Thank you for the information.
 * > Is it better to leave it in the file within your directory or put it in the
   > wp-config file??
 * No. Editing “drop-in.php” is safer that editing “wp-config.php”.
 * And I got your file system, that is:
 * > – File system: direct
 * It’s quite normal.
 * Actually, the possible causes of the error you’ve experienced may be as follows:
 * 1. The SQLite database file was broken.
    2. The permission of SQLite database
   was not suitable for this plugin.
 * I’ve sometimes had experiences 1. That’s why I asked you to “reset” it. But it
   might not be your case. So we have to investigate 2, e.g. the permission of the
   SQLite database file.
    The default permission depends on the server’s setting.
   And IMO, a developer should not change it arbitrarily mainly for the security
   reason.
 * OK, I have to ask you: **Do you know where the temporary directory in your server
   is placed?** Typically, it may be “/var/tmp/” or “/tmp/”. Or in a certain case,
   it may be “/wp-content/”.
 * And the name of SQLite database file is “/var/tmp/ip-geo-block-%d.sqlite” for
   example where “%d” is blog ID, e.g. numerical number. If you can find it, please
   try to set the permission as “664” (rw-rw-r–) or “666” (rw-rw-rw-). The former
   is better.
 * If you can not find it, I have to ask you to replace a file to [new one](https://raw.githubusercontent.com/tokkonopapa/WordPress-IP-Geo-Block/3.0.6/ip-geo-block/admin/includes/class-admin-ajax.php)
   which I made to investigate where it is. But it should be the next step.
 * I’d appreciate your cooperation.
    Thanks!
    -  This reply was modified 8 years, 5 months ago by [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/).
 *  Thread Starter [unkfrank](https://wordpress.org/support/users/unkfrank/)
 * (@unkfrank)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9800093)
 * So you were right, the tmp folder is locate at /tmp. The folder was 644. I changed
   it to 666.
    Now when I access the Logs page I get:
 * DataTables warning: table id=ip-geo-block-validation-logs – Ajax error. For more
   information about this error, please see [http://datatables.net/tn/7](http://datatables.net/tn/7)
 * and the same error for the Statistics page.
 * ?
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9800218)
 * Oh my! It never rains but pours!!
 * I think that the ajax error has no relation to the issue of “Live update” and
   SQLite, right?. How do you think? Did you have that ajax error on pop up dialog
   or in the console of your browser?
 * Just in case, please try to clear your browser cache.
 * I’d appreciate your kind cooperation.
    Thanks.
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9801521)
 * Hi Frank,
 * Could you restore “drop-in.php” to the original state by commenting out the line
   of “IP_GEO_BLOCK_DEBUG” ?
 *     ```
       /**
        * Enables some debug features on dashboard
        *
        */
       // define( 'IP_GEO_BLOCK_DEBUG', true );
       ```
   
 * Actually, the debug version script is used when it’s true. So if you do not have
   the ajax error before you edit “drop-in.php”, the above will fix the issue.
 * Thanks.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Readonly Table Error’ is closed to new replies.

 * ![](https://ps.w.org/ip-geo-block/assets/icon-128x128.png?rev=1148568)
 * [IP Geo Block](https://wordpress.org/plugins/ip-geo-block/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ip-geo-block/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ip-geo-block/)
 * [Active Topics](https://wordpress.org/support/plugin/ip-geo-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ip-geo-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ip-geo-block/reviews/)

## Tags

 * [readonly](https://wordpress.org/support/topic-tag/readonly/)

 * 11 replies
 * 2 participants
 * Last reply from: [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/readonly-table-error/#post-9801521)
 * Status: not resolved