Troubleshooting

Keitaro is working weirdly. How can I find the reason?

  • Go to Service > Status page. Find the error log and check if there are errors.
  • Check php error log /var/log/errors.log (path from Keitaro root);

Some descriptions of errors you'll find below. Also, you can contact us at support@keitaro.io.

Authentication fails, "Authentication blocked" error displayed

It was admin panel brute-force attack protection. Delete the file /var/auth/store.dat to release lock.

Cannot get licenses, the connection to the servers fails

Here are some reasons:

  1. Nameserver, that set in /etc/resolve.conf, is not available;
  2. Firewall is configured so that it blocks all outbound connections;
  3. The server keitaro.io is not available.

The solution for hostings:

The solution for servers:

1. Open keitarotds.com in your browser. If the website is not available email us at support@keitaro.io.

2. If you have shared hosting contact the hosting support team and ask them “Why the connection to keitaro.io is blocked?”.

2. If you have your own server, send a ping to keitaro.io from the server console.

ping keitaro.io

If there is an error “Unknown host” check which ns-servers are contained in the file /etc/resolve.conf of the server. You can add there DNS from Google;

nameserver 8.8.8.8
nameserver 8.8.4.4

If you still have an “Unknown host” error write at /etc/hosts

78.46.91.189 keitaro.io

If there is an error “Timed out” check your firewall settings. Contact a hosting support team if necessary.

"Sorry, Please create .../var/cache/*** and SET Mode 0777 or any Writable Permission!"

These messages appear when cron is executed funder root or other username. Setup the cron to the user under whose name domain is functioning. Delete the content in /var/cache and set 777 attributes.

"Server connection failed. Impossible to get the license"

Check if https://keitaro.io opens on your computer. If it does:

  • Check your firewall settings;
  • Ping keitaro.io from the server;
  • Check the status of DNS servers registered in /etc/resolve.conf of the server;
  • Download the script test.php. Upload it to TDS directory and open in your browser.

...visitors.processing.dat exists (resuming) Fatal error: Allowed memory size of nnn bytes exhausted

The reason is that php is not enough memory to upload stored data in the database.

Possible solutions:

  1. Use the storage in Redis
  2. Increase the memory in php.ini. The directive memory_limit.

"The encoded file index.php cannot be run because the php.ini setting auto_prepend_file or auto_append_file is in use."

Open .htaccess file and uncomment the lines:

#php_value auto_prepend_file none
#php_value auto_append_file none

Save and set 444 attributtes. Then the file will not be erased after Keitaro update.

"Warning: touch(): Unable to create file /admin/..//var/cron/partitioning.lock because Permission denied"

Set 777 attributes for var/ directory and all the contents.

"Сannot be processed because an untrusted PHP zend engine extension is installed"

Turn off eAccelerator.

"Connection attempt failed: SQLSTATE[08004] [1040] Too many connections"

The maximum limit of connections set in MySQL configuration is exceeded. Increase the max_connections value in /etc/my.cnf and reload MySQL.

"Connection attempt failed: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket"

Database cannot stand the load. Go to Keitaro TDS settings, find the option “Traffic processor storage” in “Performance” tab and choose “Files” or “Redis”.

"Got error 28 from storage engine"

It means “not enough disk space”.

To show disc space in server console, use command below

$ df -h

"Error while connecting redis: Redis server went away"

For hostings

  1. Open the page Maintenance > Settings > Performance.
  2. Set “Files” at the “Storage for draft data” option.

For servers

1. Check if Redis is running:

$ service redis status

2. If it is stopped run it

$ service redis start

3. Add to autoload (CentOS)

$ chkconfig redis on

Test Redis by this script:

<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);

"Warning fopen(FILENAME): failed to open stream: Permissions denied"

Set attributes 775 or 777 to files which contain error.

"1286: Unknown storage engine 'InnoDB'"

For hostings Contact a hoster support team to help resolve this error.

For owners of the servers Add in my.cnf:

default-storage-engine=innodb 
default-table-type=innodb

and reboot MySQL:

service mysql restart

"Got error -1 from storage engine"

Open the MySQL configuration file my.cnf (at /etc/my.cnf or /etc/mysql/my.cnf). Replace the directive value:

innodb_force_recovery = 0

Restart MySQL

service mysql restart

Warning: session_start(): open(/tmp/sess_eruq40a3agi2a858ekbuhd7750, O_RDWR) failed: Permission denied (13) in /.../lib/Keitaro/Session.php on line 0

The error says that you do not have rights to create session in the directory sessions. Change the path for storing sessions in the directive session.save_path (php.ini) or increase attributes for the current directory.

Data is not stored in Redis

Try to clear Redis: redis-cli -r FLUSHALL

If it helped you, check the memory limit at the Redis configuration.

Countries of all streams with Sypex database are not defined

Check if there is in the php configuration mbstring.func_overload = 2. If it is there change it to mbstring.func_overload = 0

Sometimes TDS shows an Internal Error or a blank screen

Check whether the module “xcache” is connected. There are many cases of incompatibility with ioncube. Disable this module, if possible.

PHP Warning: unpack(): Type L: not enough input, need 4, have 0

Add in php.ini this code:

mb_internal_encoding("8bit");

It is possible that php-cli has its own php.ini. Add this code in it also.

After making changes, restart the web server (apache, php-fpm).

MySQL server has gone away (with Vesta)

Open the MySQL configuration file /etc/my.cnf. Comment out the line

#wait_timeout=10

and restart MySQL.

service mysqld restart

MySQL server has gone away (without Vesta)

1. Make sure that the “MySQL” is not selected in the settings of the storage.

2. If you have not installed Redis, it is not recommended to check for the uniqueness by IP at the campaigns.

3. If the server has less than 1GB memory, OOMKiller can be activated. OOMKiller is a system utility that kills processes when the system gets low on memory. You can create a swap-file that can helps.

Error "MySQL server has gone away" (or "No file or directory")

1. Check if there is wait_timeout.

You can do this in a terminal:

mysql -e "show variables like 'wait_timeout';"

+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 30 |
+---------------+-------+

To disable, delete or comment in a config /etc/my.cnf line

#wait_timeout=10

Then restart MySQL.

service mysqld restart
service mysql restart
service mariadb restart

2. Make sure that “Files” or “Redis” are chosen in database settings.

3. If there is an opportunity, install Redis.

4. If there is less than 1GB of memory on a server, OOMKiller can work out. OOMKiller is a system utility, which kills processes if there's a lack of memory. The creating of swap-file can help

Define which web-server is installed.

Apache

Check if mod_rewrite extension is on, and there is the following directive in domain settings (httpd.conf):

AllowOverride All

Nginx

Open the domain configuration in nginx (/etc/nginx/nginx.conf or in /etc/nginx/vhosts/). Find the “location / {…}” section and add:

try_files $uri $uri/ /index.php?$args;

Unable to save the updated license

Check the available free space. For example, using the console:

df -h

You will see something like this result:

Filesystem      Size   Used  Avail Capacity   iused    ifree %iused  Mounted on
/dev/disk1     465Gi  407Gi   57Gi    88% 106779354 15058244   88%   /
...

The penultimate column shows the percentage of used space.

Check the user quota:

quota -u USERNAME

055: Expression #6 of SELECT list is not in GROUP BY clause and contains nonaggregated column...

Edit the file /etc/my.cnf and replace the value:

[mysqld]
...
sql-mode=""

Restart MySQL.

User 'xxx' has exceeded the 'max_connections_per_hour'

The user has the limit number of connections per hour.

Solutions:

1. Remove or increase the limit

GRANT USAGE ON *.* TO 'xxx'@'localhost' WITH MAX_CONNECTIONS_PER_HOUR 0;

2. Switch the handler storage to Files or Redis (Maintenance > Settings > Performance).

1054: Unknown column 'conversions' in 'field list'

Open the page “Maintenance > Migrations” and run the migration 95.

Models\Stream #X not found

Use phpMyAdmin to run this command:

DELETE FROM keitaro_triggers WHERE stream_id NOT IN (SELECT id FROM keitaro_streams)

Extension php_redis not installed!

Open the page “Settings”. Switch the cache and data storage on the “Files”.

How to get rid of the IP-addresses 0.0.0.0?

Disable IPv6 on the server. This will cause all users to connect to a server by IPv4.

In CentOS edit the file /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Then run:

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

Cloudflare

Cloudflare activate IPv6 and does not allow you to disable it through interfaces. But you can still disable it through the API. Therefore, you need a terminal. This can be a server terminal, an OS X terminal or Linux.

Copy the following code to the notepad:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/ZONEID/settings/ipv6" \
     -H "X-Auth-Email: EMAIL" \
     -H "X-Auth-Key: API_KEY" \
     -H "Content-Type: application/json" \
     --data '{"value":"off"}'

Replace ZONEID with the zone, you can take it on the Overview page Replace EMAIL with your account email address.

And API_KEY on the key, which is taken on the “Profile” page.

Error 504 when unloading report

You need to increase timeouts.

If PHP-FPM is used, add the instruction fastcgi_read_timeout N;:

location ~ \.php$ {
  fastcgi_pass unix:/tmp/php5-fpm.sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;

  fastcgi_read_timeout 300;      # <----
}

In the case of Apache, you need to increase the proxy time:

server {
...
    proxy_connect_timeout       600;
    proxy_send_timeout          600;
    proxy_read_timeout          600;
    send_timeout                600;
    client_header_timeout  600;
    client_body_timeout    600;
...
}

For both cases you can increase the external timeouts:

server {
...
    send_timeout                600;
    client_header_timeout  600;
    client_body_timeout    600;
}

Restart Nginx

service nginx reload

igbinary_unserialize_header: unsupported version: 726750533, should be 1 or 2

You need to disable igbinary module in php.

The configuration files can be found in such a way:

php --ini | grep ini

PHP-FPM 7.0 is installed and it takes up the entire server memory

PHP 7.0 has a problem with a memory leak. You need to correct config of PHP-FPM.

Switching to ondemand will cause the PHP-FPM create processes adaptively the load:

pm = ondemand

Uncomment these options will allow PHP-FPM self-cleaning:

pm.process_idle_timeout = 10s
pm.max_requests = 500

[ERROR] mysqld: Can't create/write to file '/var/run/mariadb.pid' (Errcode: 13 "Permission denied")

If you used “1-click installer”, run this script to update the configuration:

curl -sSL https://keitarotds.com/install.sh | bash -s -- -r -t tune-mariadb,monit

Redis is LOADING the dataset.

That solution drop all the temp stats, but restores tracker stability. Run these commands in server terminal:

rm -rf /var/lib/redis/*
service redis restart

How to get rid of "[IPv6]" in reports

We need to disable IPv6 on a server for this. All visitors will connect to the server with IPv4. In CentOS edit the /etc/sysctl.conf file:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

Then execute:

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

Cloudflare

Cloudflare imposes IPv6 on all new domains. To disable this, you need some tech knowledge and experience with the terminal.

1. Go to “Network”. Find “IPv6 Compatibility” domain settings. It is in “On” position and you can't disable it.

2. Copy the code below to the notepad:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/ZONEID/settings/ipv6" \
     -H "X-Auth-Email: EMAIL" \
     -H "X-Auth-Key: API_KEY" \
     -H "Content-Type: application/json" \
     --data '{"value":"off"}'

3. Change ZONEID to the zone, which can be taken on “Overview” page.

4. Change EMAIL to your account's email.

And API_KEY to the key, which can be found on “My Profile” page - “Global API Key”.

4. Now copy the edited code from a notepad and launch this code in any terminal.

5. Check if the domain's “IPv6 Compatibility” settings are Off.

IPv6 for each domain is disabled separately, which means you need to repeat the steps for every domain.