To install redis php module in Ubuntu 16.04, run
apt -y install php-redis
If you are using Apache, restart Apache.
systemctl restart apache2
If php-fpm restart
systemctl restart php7.0-fpm
You will see following in your phpinfo()

To install redis php module in Ubuntu 16.04, run
apt -y install php-redis
If you are using Apache, restart Apache.
systemctl restart apache2
If php-fpm restart
systemctl restart php7.0-fpm
You will see following in your phpinfo()

Install latest Redis on Ubuntu/Debian Server
Install Redis on Plesk Debian Server
Install Redis from Source
Installing Redis PHP module CentOS 7
Connect to redis from PHP
Monitor redis with redis-cli
redis commander – Web GUI for Redis
How to find Redis data directory
How to flush Redis cache
Redis error currently not able to persist on disk
Checking if Redis works
# telnet 127.0.0.1 6379 set testkey 10 get testkey
Example
root@ip-10-0-0-31:~# telnet news24redis.cylrbg.0001.use1.cache.amazonaws.com 6379 Trying 10.0.0.223... Connected to news24redis.cylrbg.0001.use1.cache.amazonaws.com. Escape character is '^]'. set testkey 10 +OK get testkey $2 10 quit +OK Connection closed by foreign host. root@ip-10-0-0-31:~#
Count Number of Keys
To count number of keys, use
DBSIZE
Example
root@ip-10-0-0-31:~# telnet news24redis.cylrbg.0001.use1.cache.amazonaws.com 6379 Trying 10.0.0.223... Connected to news24redis.cylrbg.0001.use1.cache.amazonaws.com. Escape character is '^]'. DBSIZE :4114
Here DBSIZE returned 4114, that means you have that much key/value stored in redis.
Flush ALl
To flush all keys, use
redis-cli flushall
composer is PHP package manager, to install, run
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Manual Install
Download latest version of composer.phar from
https://getcomposer.org/download
At the time of writing latest version is 2.9.2, before you install find latest version and update link below.
mkdir ~/bin
wget https://getcomposer.org/download/2.9.2/composer.phar
mv composer.phar ~/bin/composer
chmod 755 ~/bin/composer
Run this every time you change composer.json or pull newer copy from git.
composer install
composer show -i
Only run this if you need to update software versions. Don’t run it in production. Only run when you are project maintainer and need everyone else use latest version of packages.
composer update
To update wordpress from admin area, you need to be running web server as the user owning files. This is not possible when you run PHP as apache module.
To fix this, you need to edit your wp-config.php and add following to end of the file.
define('FS_METHOD', 'ftpext');
define('FTP_USER', 'FTP_USERNAME');
define('FTP_PASS', 'FTP_PASSWORD');
define('FTP_HOST', 'localhost');
define('FTP_SSL', false);
You can read about about this at
https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants
Above configuration work fine for me when files are inside public_html folder of FTP homed directory.
Game Server Control Panel
https://play.battlesnake.com/ – You play by coding snake movement.
Multiplayer Game Servers
https://github.com/heroiclabs/nakama – Nakama is the leading open source game server framework for building online multiplayer games in Godot, Unity, Unreal Engine, MonoGame, LibGDX, Defold, Cocos2d, Phaser, Macroquad and more.
Photon Server – 100 clients free. – require Windows server to run.
OpenTibia – Open source game server for game Tibia. Works on Linux/windows.
Here are some control panel for game hosting
pterodactyl

Open Source, Free. Using Laravel PHP framework, Docker. Limited game support.
TCADMIN
This is popular game hosting control panel. It is $15 per month
GameCP
Cost $4 per month. Look like outdated software. I installed this, did not work. There is no support. Tickets never get replied by GameCP support.
pufferpanel
PufferPanel is an open source game server management panel designed for both small networks and game server providers. PufferPanel supports Minecraft, Spigot, Sponge, Source Dedicated Servers, BungeeCord, PocketMine and much more.
automysqlbackup
Plesk MySQL Daily Backup Script
MySQL Backup using mysqldump
Redirect a site to HTTPS using .htaccess file
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Redirect a web site to SSL using Apache Virtual Host
ServerName www.yourdomain.com
Redirect permanent / https://www.yourdomain.com/
OR
RewriteEngine on
RewriteCond %{SERVER_NAME} =yourdomain.com [OR]
RewriteCond %{SERVER_NAME} =www.yourdomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Redirect a Site to HTTPS using PHP
if ($_SERVER["HTTPS"] != "on") {
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.yourdomain.com");
}
Redirect www to non-www URL
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301]
Create file
mkdir /usr/serverok/
vi /usr/serverok/plesk-mysql-backup
With the following content
#!/bin/bash
# Author: admin@serverok.in
# Web: https://serverok.in/plesk-mysql-daily-backup-script
if [ ! -d "/mysql-backup/" ]
then
mkdir /mysql-backup/
fi
mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "show databases" | grep -v "+-------------" | grep -v "Database" | grep -v "information_schema" | grep -v "performance_schema" > /tmp/sok-dbs.txt
for db in `cat /tmp/sok-dbs.txt`
do
/usr/bin/mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` --opt --triggers --routines --events $db > /mysql-backup/$db.sql
if [ $? -ne 0 ]; then
# if you need email alert when backup fail, uncomment following line, add your email address
# echo "database backup $db failed - `date`" | mail -s 'MySQL Backup failed' you@your-email.com
echo "Backup failed"
fi
done
If you need multiple copies of MySQL database kept, use
https://gist.github.com/serverok/5a247a5b8485a6a29764f12118a7f727
Make it executable
chmod 755 /usr/serverok/plesk-mysql-backup
Set it to run as cronjob
1 1 * * * /usr/serverok/plesk-mysql-backup > /var/log/sok-mysqldb-backup.log 2>&1
crontab
Start a program after reboot using cronjob
Running wp-cron with cronjob
Cronjob for Magento 1.9
set vi as default cronjob editor
Cron Job fails with Error Message “(getpwnam() failed): No such file or directory”
* * * * * = every minute */5 * * * * = every 5 minute 0 * * * * = every hour 0 * * * * = every day at 00:00 hour. 0 0 * * 0 = every Sunday at 0 minutes, 0 hour.
Here is how it works.
# Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed
To disable cronjob output, add the following to the end of the script
> /dev/null 2>&1
or
1> /dev/null 2> /dev/null
To save the result of a cronjob to a file, use
20 5 * * * /bin/bash /usr/serverok/mysqldb-backup.sh > /var/log/mysqldb-backup.log 2>&1
To list all cronjob, run
crontab -l
To edit all cronjobs, run
crontab -e
perl: warning: Falling back to a fallback locale (“C.UTF-8”).
sudo apt-get install locales-all
dpkg-reconfigure locales
On a Linux server, if the language is different, you can change it to English for the current session by running
export LC_ALL=C
Example
root@root1229:~# ll -bash: ll: Kommando nicht gefunden. root@root1229:~# export LC_ALL=C root@root1229:~# ll -bash: ll: command not found root@root1229:~#
See current language
root@hestia-lnx:~# locale LANG=fr_FR.UTF-8 LANGUAGE= LC_CTYPE="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8" LC_MESSAGES="fr_FR.UTF-8" LC_PAPER="fr_FR.UTF-8" LC_NAME="fr_FR.UTF-8" LC_ADDRESS="fr_FR.UTF-8" LC_TELEPHONE="fr_FR.UTF-8" LC_MEASUREMENT="fr_FR.UTF-8" LC_IDENTIFICATION="fr_FR.UTF-8" LC_ALL= root@hestia-lnx:~#
List Available Languages
root@hestia-lnx:~# localectl list-locales C.UTF-8 en_US.utf8 fr_FR.utf8 root@hestia-lnx:~#
Change langauage
localectl set-locale LANG=en_US.UTF-8
How to cut lines separated by multiple spaces?
Here is an example of cut command, that will remove all PHP packages from system
dpkg -l | grep php | cut -d" " -f3 | xargs apt purge -y
Get user names
cut -d':' -f1 /etc/passwd
Display users with SSH enabled
grep "/bin/bash" /etc/passwd | cut -d':' -f1,6
List all IPs that have accessed admin area from Apache Log
cat LOG_FILE_NAME_HERE | grep '/admin/' | cut -d' ' -f1 | sort -n | uniq
See Linux Commands