แบบ Reply
<?php
$strAccessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$content = file_get_contents('php://input');
$arrJson = json_decode($content, true);
$strUrl = "https://api.line.me/v2/bot/message/reply";
$arrHeader = array();
$arrHeader[] = "Content-Type: application/json";
$arrHeader[] = "Authorization: Bearer {$strAccessToken}";
http_response_code(200);
เรื่องราวและ ทัศนะต่างๆ กับสิ่งต่างๆที่ไปประสบพบเจอมา โดยนำมาวิเคราะห์ตามแนวความคิดและวิถีทางแล้วบันทึกไว้
22 ม.ค. 2563
Time Remain Function PHP
<?php
function remainTime($fromTime=0, $toTime = 0) {
$returnTime = array('day'=>0,'hour'=>0,'minute'=>0,'second'=>0);
$seconds = floor($toTime - $fromTime);
if($seconds < 0){
return $returnTime;
}
function remainTime($fromTime=0, $toTime = 0) {
$returnTime = array('day'=>0,'hour'=>0,'minute'=>0,'second'=>0);
$seconds = floor($toTime - $fromTime);
if($seconds < 0){
return $returnTime;
}
ป้ายกำกับ:
php
8 ม.ค. 2563
rc.local on Ubuntu 18.04
Create file
vi /etc/systemd/system/rc-local.service
Add
[Unit]
Description=Start up script
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
Create file /etc/rc.local with
#!/bin/bash
touch /root/OK
exit 0
Make it executable with
chmod 755 /etc/rc.local
Reload systemd
systemctl daemon-reload
Enable the service
systemctl enable sok-startup.service
vi /etc/systemd/system/rc-local.service
Add
[Unit]
Description=Start up script
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
Create file /etc/rc.local with
#!/bin/bash
touch /root/OK
exit 0
Make it executable with
chmod 755 /etc/rc.local
Reload systemd
systemctl daemon-reload
Enable the service
systemctl enable sok-startup.service
7 ม.ค. 2563
Setting up Flask and Apache on Ubuntu 18.04 Server
Setup Python3 Environment
First, update apt-get.
$ sudo apt-get update
Python3 installed.
$ sudo apt-get install python3-pip
Get virtualenv.
$ pip3 install virtualenv
Create the project folder.$ mkdir flaskproject
Set up the virtual environment.
$ cd flaskproject
$ virtualenv venv
Activate the environment (use deactivate to exit the environment).
$ . venv/bin/activate
Fix Bug Phpmyadmin Warning in ./libraries/sql.lib.php#601
#vi /usr/share/phpmyadmin/libraries/sql.lib.php
chang line
chang line
|| (count($analyzed_sql_results[‘select_expr’] == 1)
to
|| (count($analyzed_sql_results[‘select_expr’]) == 1
ป้ายกำกับ:
Phpmyadmin
How To Install LAMP on Ubuntu 18.04 LTS
Install Apache2
apt install apache2 apache2-utils libapache2-mod-phpInstall MySQL
apt install mysql-serverInstall PHP
apt install php-fpm php-mysqlInstall PHPMYADMIN
apt install phpmyadminError #1698 - Access denied for user 'root'@'localhost'
$ sudo mysql -u root -p
$ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';
$ sudo service mysql restart
ป้ายกำกับ:
LAMP
Ubuntu server 18.04 config static IP with netplan
แก้ไขแฟ้ม
/etc/netplan/01-netcfg.yaml
/etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
enp0s8:
dhcp4: no
addresses: [ 172.0.0.253/22 ]
gateway4: 172.0.0.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
หลังจากแก้ไขค่าเสร็จแล้ว สั่งให้ network ทำงานใหม่ ใช้คำสั่ง
sudo netplan apply
ป้ายกำกับ:
network
5 ม.ค. 2563
server responded Algorithm negotiation failed On Ubuntu 16.04
Enter the next message in the final line.
# Ciphers Ciphers aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,arcfour KexAlgorithms diffie-hellman-group1-sha1
After that restart service
service sshd restart
ป้ายกำกับ:
ssh
สมัครสมาชิก:
ความคิดเห็น (Atom)