How can I fix permission troubles?

Posted on May 11, 2021

This plugin must have read/write permission at the certain places outside of the plugin folder. But in some cases, you might find the error message related to the permission because of your server’s security configurations.

When you meet those cases, you have to configure something related to the WordPress file system by your own hand.

Geolocation API library

Configuring file system

If your host is running under a special installation setup involving symlinks, or certain installations with a PHP FTP extension, you’ll see the following error message when you install and activate this plugin for the first time:

Error of Filesystem

In this case, as of the instruction in this document at codex, you have to configure some symbols in your wp-config.php something like this:

define( 'FTP_HOST', 'http://example.com/' );
define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );

If you have some reasons you can’t do this, please follow the next instruction.

Installing Geolocation API library

When you’ll see the following when you jump to the option page of this plugin:

Error of IP Geo API

In this case, you should install ip-geo-api that includes geolocation API library named IP-Geo-API for Maxmind and IP2Location under one of the following folders:

  1. /wp-content/
  2. /wp-content/uploads/
  3. /wp-content/plugins/ip-location-block/

You can download the ZIP file and upload ip-geo-api in the unzipped folder onto the above 1. or 2 with a proper permission using FTP.

IP-Geo-API

Note: Installing ip-geo-api into 3. is not recommended, because it will be removed at every time this plugin is updated.

Here’s a final tree view after uploading ip-geo-api to 1.

/wp-content/ip-geo-api/
  ├── index.php
  ├── ip2location
  │   ├── IP2Location.php
  │   ├── bcmath.php
  │   └── class-ip2location.php
  └── maxmind
      ├── LICENSE
      ├── class-maxmind.php
      ├── geoip.inc
      └── geoipcity.inc
NOTE: Please refer to “Hardening WordPress” to give ip-geo-api and the following folders (ip2location and maxmind) a proper permission. It may be 755 but should be confirmed by consulting your hosting administrator.

Force to load WP core

Error of .htaccess

When you enable “Force to load WP core” options, this plugin will try to configure .htaccess in your /wp-content/plugins/ and /wp-content/themes/ folder in order to protect your site against the malicous attacks targeted at the OMG plugins and themes.

If you encounter an “Unable to write” message for plugins, you should put the following directives into your /wp-content/plugins/.htaccess manually instead of enabling this option:

# BEGIN IP Location Block
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /wp-content/plugins/ip-location-block/
RewriteCond %{REQUEST_URI} !ip-location-block/rewrite.php$
RewriteRule ^.*.php$ rewrite.php [L]
</IfModule>
# END IP Location Block

The absolute path /wp-content/plugins/ should be changed according to your site configuration. And here’s an example directives in /wp-content/themes/.htaccess:

# BEGIN IP Location Block
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /wp-content/plugins/ip-location-block/
RewriteRule ^.*.php$ rewrite.php [L]
</IfModule>
# END IP Location Block