Category Archives: Hosting

centos 8 lsphp74

yum install http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm
dnf install lsphp74 lsphp74-mysqlnd lsphp74-process lsphp74-mbstring lsphp74-mcrypt lsphp74-gd lsphp74-opcache lsphp74-bcmath lsphp74-pdo lsphp74-common lsphp74-xml lsphp74-json

[WARNING] Server signature does not match the license key

/usr/local/lsws/bin/lswsctrl start
[WARNING] Server signature does not match the license key #2.
Please request a new license key!
[WARNING] Server signature does not match the license key #2.
Please request a new license key!
2020-08-17 11:24:47.232298 [NOTICE] Memory size is: 4718592KB.
2020-08-17 11:24:47.722767 [ERROR] [LICENSE] License key operation failure: EXCEPTION LR.AM: Invalid license key file
[FATAL] license problem, back to Apache!
2020-08-17 11:24:48.745494 [NOTICE] Switch back to Apache …
[ERROR] Failed to start litespeed!
[ERROR] Cannot detect control panel environment. Only cPanel WHM, Plesk, DirectAdmin are checked for now.
[WARNING] Server signature does not match the license key #2.
Please request a new license key!
[WARNING] Server signature does not match the license key #2.
Please request a new license key!
2020-08-17 11:24:51.954129 [NOTICE] Memory size is: 4718592KB.
2020-08-17 11:24:52.413312 [ERROR] [LICENSE] License key operation failure: EXCEPTION LR.AM: Invalid license key file
[FATAL] license problem, back to Apache!
2020-08-17 11:24:53.441160 [NOTICE] Switch back to Apache …
[ERROR] Failed to start litespeed!

/usr/local/lsws/bin/lshttpd -r
/usr/local/lsws/bin/lshttpd -V
/usr/local/lsws/bin/lswsctrl restart

new-authz error: {“type”:”urn:acme:error:unauthorized”,”detail”:”Error creating new authz :: Validations for new domains are disabled in the V1 API (https://community.letsencrypt.org/t/end-of-life-plan-for-acmev1/88430)”,”status”: 403

acme.sh change api version
acme.sh v1 to v2

su - acme -s /bin/bash
mkdir temp && git clone https://github.com/acmesh-official/acme.sh.git temp
mv acme.sh acme.sh_backup && mv temp/acme.sh .

./acme.sh/acme.sh --issue

centos 7 mysql 5.7

yum install https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm -y

yum repolist enabled | grep “mysql.*-community.*”
mysql-connectors-community/x86_64 MySQL Connectors Community 165
mysql-tools-community/x86_64 MySQL Tools Community 115
mysql57-community/x86_64 MySQL 5.7 Community Server 444

systemctl start mysqld
grep ‘temporary password’ /var/log/mysqld.log
2020-08-08T18:56:50.367913Z 1 [Note] A temporary password is generated for root@localhost: xxxxxxxxxxxxx

converting CentOS 7 to VZ7

centos install virtuozzo
yum install epel-release
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/p/python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm
wget https://download.openvz.org/virtuozzo/releases/openvz-7.0.14-136/x86_64/os/Packages/o/openvz-release-7.0.14-3.vz7.x86_64.rpm
yum localinstall openvz-release-7.0.14-3.vz7.x86_64.rpm python-subprocess32-3.2.7-1.vz7.5.x86_64.rpm

wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/r/readykernel-scan-0.11-1.vl7.noarch.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/z/zstd-1.4.4-1.vl7.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7/x86_64/os/Packages/v/vzlinux-release-7-1.vl7.90.x86_64.rpm

mv /etc/yum.repos.d/CentOS-* /root/

rpm -e --nodeps --justdb json-c
yum erase jansson
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/jansson-2.10-1.vl7.1.x86_64.rpm
wget http://repo.virtuozzo.com/vzlinux/7.8/x86_64/os/Packages/j/json-c-0.11-13.vl7.1.x86_64.rpm

yum localinstall jansson-2.10-1.vl7.1.x86_64.rpm
yum localinstall json-c-0.11-13.vl7.1.x86_64.rpm
yum install prlctl prl-disp-service vzkernel *ploop*
yum update

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : Virtuozzo (3.10.0-1127.18.2.el7.x86_64) 7.0.14
1 : Virtuozzo (3.10.0-1127.8.2.vz7.151.14) 7.0.14
2 : Virtuozzo (3.10.0-1127.8.2.el7.x86_64) 7.0.14
3 : Virtuozzo (0-rescue-9063ac396d784f4c997ceacdd0590c25) 7.0.14

grub2-set-default 1
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

#OVZ templates
yum install *ez.noarch

nohup style php


$lock = fopen('/path/to/pid', 'c+');
if (!flock($lock, LOCK_EX | LOCK_NB)) {
die('already running');
}

switch ($pid = pcntl_fork()) {
case -1:
die('unable to fork');
case 0: // this is the child process
break;
default: // otherwise this is the parent process
fseek($lock, 0);
ftruncate($lock, 0);
fwrite($lock, $pid);
fflush($lock);
exit;
}

if (posix_setsid() === -1) {
die('could not setsid');
}

fclose(STDIN);
fclose(STDOUT);
fclose(STDERR);

$stdIn = fopen('/dev/null', 'r'); // set fd/0
$stdOut = fopen('/dev/null', 'w'); // set fd/1
$stdErr = fopen('php://stdout', 'w'); // a hack to duplicate fd/1 to 2

pcntl_signal(SIGTSTP, SIG_IGN);
pcntl_signal(SIGTTOU, SIG_IGN);
pcntl_signal(SIGTTIN, SIG_IGN);
pcntl_signal(SIGHUP, SIG_IGN);

// do some staff

// to kill the proccess
$lock = fopen(‘/path/to/pid’, ‘c+’);
if (flock($lock, LOCK_EX | LOCK_NB)) {
die(‘process not running’);
}
$pid = fgets($lock);

posix_kill($pid, SIGTERM);