IT Daily Documentation

phpMyAdmin has no type error

Problem: There is an error in phpMyAdmin export page -- “Field:group: xxx has no type”

Solution: update Form.php in phpMyAdmin path.

  1. Add below function in Form.php
    protected function cleanGroupPaths(array $form): array
    {
        foreach($form as &$name) {
            if (mb_strpos((string) $name, ':group:') === 0) {
                $name = str_replace('/', '-', $name);
            }
        }
        return $form;
    }

2. update loadForm function

    public function loadForm($form_name, array $form)
    {
        $this->name = $form_name;

        $form=$this->cleanGroupPaths($form);

        $this->readFormPaths($form);
        $this->readTypes();
    }
}

ref: https://github.com/williamdes/phpmyadmintest/commit/47971806316304f650ca1b3742e2a53801d2a794

phpMyAdmin problem – configuration storage is not completely configured, some extended features have been deactivated.

Problem: Some day enter Phpmyadmin then an message pop up -- “configuration storage is not completely configured, some extended features have been deactivated.”

Solution: You can create a table for storing configuration.

  1. import script from phpMyAdmin/sql/create_tables.sql
  2. create user and grant SELECT, INSERT, DELETE, UPDATE, ALTER privileges in phpMyAdmin.
  3. open config.inc.php and update below line (uncomment it)
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'password_you_set_in_phpmyadmin';

/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';

Centos 7 install Zabbix server

Today want to try using open source monitor tool. Below is the guide for Centos 7 (x86_64). We will using yum and wget.

First close firewall, selinux and reboot

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

systemctl disable --now firewalld

reboot

Go to Zabbix Official Repository Download zabbix-release-3.4-1.el7.centos.noarch.rpm and download it.

wget https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum localinstall zabbix-release-3.4-1.el7.centos.noarch.rpm

install zabbix server and agent

yum -y install zabbix-get zabbix-server-mysql zabbix-web-mysql zabbix-agent
cd /usr/share/doc/zabbix-server-mysql-3.4.6/

Add below lines to zabbix_server.conf

DBHost=localhost
DBPassword=password
DBName=zabbix

Install Zabbix mysql Database.

yum -y install mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation

Create Zabbix database for store all data

mysql -u root -p
create database zabbix; 
grant all privileges on zabbix.* to [email protected]'localhost' identified by 'password'; 
grant all privileges on zabbix.* to [email protected]'%' identified by 'password'; 
flush privileges;
\q

ref: https://technologyrss.com/how-install-zabbix-server-centos-7/

Laravel show 403 error in Nginx

Problem: Migrate Laravel into Nginx, when enter index page, it cause a 403 error.

Solution: Go to Nginx config file, change try_files line to below line:

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

String id cannot be empty in WordPress

How to know it: Open the wp-config.php file and change for this line:

define('WP_DEBUG', false);

to true

define('WP_DEBUG', true);

Problem: Same situation like this using WPML Plugin.

Solution: check database, there are some rows which id is zero. Try to delete all of them.

Then, the table must not have primary key, so set a primary key and set auto increment.

SET timeout value to prevent long-running SELECT queries for Mysql/MariaDB

Problem: Some WordPress plugin cause a lot of long-running queries and seems to want to run forever:( (You can check it out by entering SQL command “show processlist;”)

Solution: Set up session-wide or global timeout:

For MySQL, enter below command

SET SESSION MAX_EXECUTION_TIME=2000;
SET GLOBAL MAX_EXECUTION_TIME=2000;

For MariaDB, enter below command:

SET SESSION max_statement_time=2000;
SET GLOBAL max_statement_time=2000;

2000 is 2000 second.

Nextcloud in CentOS 7 guide

Suggested steps:

I suggest using Apache, because Nginx need more time to debug in some parts.

I suggest using BT panel (or AApanel for Eng ver -- https://www.aapanel.com/index.html)

Once you installed NextCloud, go to http://domain/index.php/settings/admin/overview to check any error that occurred.

  1. for error like “/.well-known/caldav” and “/.well-known/carddav” -> turn on apache rewrite function, restart apache and make sure you add AllowOverride All on Nextcloud directory on conf file.
  2. Suggest PHP 7.4. Install below php plugin: fileinfo, opcache, opcache, imagemagick, gmp. memory_limit set above 2GB. Then restart PHP
  3. for backup procedure, first you can take a reference in https://docs.nextcloud.com/server/15/admin_manual/maintenance/restore.html. Simply using command
rsync -Aax nextcloud-dirbkp/ nextcloud/

to backup folders. using command

sqlite3 data/owncloud.db .dump > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak

to backup SQlite.

Run puppeter in Cent OS 7 CLI mode

Required steps:

  1. make sure you have installed below packages:
pango.x86_64
libXcomposite.x86_64
libXcursor.x86_64
libXdamage.x86_64
libXext.x86_64
libXi.x86_64
libXtst.x86_64
cups-libs.x86_64
libXScrnSaver.x86_64
libXrandr.x86_64
GConf2.x86_64
alsa-lib.x86_64
atk.x86_64
gtk3.x86_64
ipa-gothic-fonts
xorg-x11-fonts-100dpi
xorg-x11-fonts-75dpi
xorg-x11-utils
xorg-x11-fonts-cyrillic
xorg-x11-fonts-Type1
xorg-x11-fonts-misc

use yum install to install above dependencies should be fine. And be careful your are 64 bit or 32 bit.

2. Install VNC server:

yum install tigervnc-server

and make sure you set your password through

vncpasswd

and know what to start/stop/kill vnc

systemctl start [email protected]:1.service
systemctl stop [email protected]:1.service

vncserver -kill :1

and your port should be 5901 (if you use 1.service)

3. use gnome-terminal:

export DISPLAY=:0
gnome-terminal --display=:0

4. in your js file, make sure your browser has below arguments:

const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});

Then your js file:

node index.js

6. If you need to use cronjob, you can try like this:

export DISPLAY=:0; node index.js