หน้าเว็บ

วันพฤหัสบดีที่ 28 พฤศจิกายน พ.ศ. 2562

Ubuntu : Ubuntu 14.04 Update Vmware Tools แล้ว Error

Ubuntu : Ubuntu 14.04 Update Vmware Tools แล้ว Error
https://intranet.sci.com/blog.php?u=3&b=832

root@webax:/tmp/vmware-tools-distrib# ./vmware-install.pl -d
open-vm-tools packages are available from the OS vendor and VMware recommends
using open-vm-tools packages. See http://kb.vmware.com/kb/2073803 for more
information.
Do you still want to proceed with this installation? [no]
INPUT: [no] default


ต้อง run คำสั่ง
  1. ./vmware-install.pl -f


https://kb.vmware.com/s/article/2107676

วันพุธที่ 27 พฤศจิกายน พ.ศ. 2562

Python : Script สำหรับลบข้อความใน Slack อัตโนมัติ

Python : Script สำหรับลบข้อความใน Slack อัตโนมัติ

Run ที่เครื่องที่ออกเน็ต ได้ ในที่นี้ใช้เครื่อง Extranet
1. ติดตั้งโปรแกรม
  1. sudo apt-get install python-pip

2. ติดตั้ง Slack Client
  1. pip install slackclient
3. สร้าง code removeSlack.py
  1. from slackclient import SlackClient
  2. #from time import sleep
  3. import time
  4. #import datetime
  5. from datetime import datetime, timedelta
  6.  
  7. legacy_token = 'xxxxxx'  # don't if you share your code
  8. channel = 'Cxxxxx'  # the id of the channel to delete all msgs inside
  9.  
  10. sc = SlackClient(legacy_token)
  11. response = sc.api_call('channels.info', channel=channel)
  12.  
  13. #oldest_ts = response['channel']['created']
  14. date_days_ago = datetime.now() - timedelta(days=60)
  15. oldest_ts = time.mktime(date_days_ago.timetuple())
  16. print(datetime.fromtimestamp(oldest_ts))
  17.  
  18. date_days_ago = datetime.now() - timedelta(days=30)
  19. latest_ts = time.mktime(date_days_ago.timetuple())
  20. print(datetime.fromtimestamp(latest_ts))
  21.  
  22. response = sc.api_call('channels.history', channel=channel, count=1000, oldest=oldest_ts, latest=latest_ts)
  23. allmsgs = [item['ts'] for item in response['messages']]
  24. print(len(allmsgs))
  25. for msg in allmsgs:
  26.     sc.api_call('chat.delete', channel=channel, ts=msg)
  27.     time.sleep(1)
  28. ########### Chanel Server  ###################
  29. channel = 'Cxxxxx'
  30.  
  31. sc = SlackClient(legacy_token)
  32. response = sc.api_call('channels.info', channel=channel)
  33.  
  34. #oldest_ts = response['channel']['created']
  35. date_days_ago = datetime.now() - timedelta(days=60)
  36. oldest_ts = time.mktime(date_days_ago.timetuple())
  37. print(datetime.fromtimestamp(oldest_ts))
  38.  
  39. date_days_ago = datetime.now() - timedelta(days=30)
  40. latest_ts = time.mktime(date_days_ago.timetuple())
  41. print(datetime.fromtimestamp(latest_ts))
  42.  
  43. response = sc.api_call('channels.history', channel=channel, count=1000, oldest=oldest_ts, latest=latest_ts)
  44. allmsgs = [item['ts'] for item in response['messages']]
  45. print(len(allmsgs))
  46. for msg in allmsgs:
  47.     sc.api_call('chat.delete', channel=channel, ts=msg)
  48.     time.sleep(1)
4. chmod ให้ Run ได้
5. สร้าง Cront ให้ run ตามที่ต้องการในที่นี้ run อาทิตย์ละครั้ง วันจันทร์
0 0 * * 1 python /home/pi/removeSlak.py >> /home/pi/removeSlack.log 2>&1

วันอังคารที่ 26 พฤศจิกายน พ.ศ. 2562

Ubuntu : Ubuntu 18.04 Https Free letsencrypt

Ubuntu : Ubuntu 18.04 Https Free letsencrypt
ที่ต้องมี
1. เครื่องที่จะทำต้องออก Net ได้ เพื่อ Check DNS ข้างนอก
2. ต้องมี Domain ที่ตรวจสอบจาก DNS ข้างนอกได้ เช็คได้ที่
https://check-your-website.server-daten.de/
ถ้าไม่มีจะ Error
root@intranet1804:~# certbot-auto certonly --standalone -d intranettest.sci.com -d www.intranettest.sci.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for intranettest.sci.com
http-01 challenge for www.intranettest.sci.com

Waiting for verification...
Challenge failed for domain intranettest.sci.com
Challenge failed for domain www.intranettest.sci.com
http-01 challenge for intranettest.sci.com
http-01 challenge for www.intranettest.sci.com
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:
- The following errors were reported by the server:

Domain: intranettest.sci.com
Type: dns
Detail: DNS problem: NXDOMAIN looking up A for intranettest.sci.com

Domain: www.intranettest.sci.com
Type: dns
Detail: DNS problem: NXDOMAIN looking up A for
www.intranettest.sci.com
3. Stop apace ก่อน Run Code ไม่อย่างนั้นจะ Error
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for intranettest.com
http-01 challenge for www.intranettest.com
Cleaning up challenges
Problem binding to port 80: Could not bind to IPv4 or IPv6.

IMPORTANT NOTES:
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.

เริ่มติดตั้ง letsencrypt


Step 1 – Prerequisites
Before starting work on this task, I assume you already have:

- Running Ubuntu system with sudo privileges shell access.
- A domain name registered and pointed to your server’s public IP address. For this tutorial, we use example.com and www.example.com, which is pointed to our server.
- Running web server with VirtualHost configured for example.com and www.example.com on Port 80.

Step 2 – Install Let’s Encrypt Client


Download the certbot-auto Let’s Encrypt client and save under /usr/sbin directory. Use the following command to do this.
  1. sudo wget https://dl.eff.org/certbot-auto -O /usr/sbin/certbot-auto
  2. sudo chmod a+x /usr/sbin/certbot-auto

Step 3 – Get a SSL Certificate

Let’s Encrypt do a strong Domain Validation automatically with multiple challenges to verify the ownership of the domain. Once the Certificate Authority (CA) verified the authenticity of your domain, SSL certificate will be issued.
  1. sudo certbot-auto certonly --standalone -d example.com  -d www.example.com

Above command will prompt for an email address, which is used for sending email alerts related to SSL renewal and expiration. Also, asks a few more questions. After completion, it will issue an SSL certificate and will also create a new VirtualHost configuration file on your system.

Step 4 – Check SSL Certificate

If everything goes fine. A new ssl will be issued at below location. Navigate to below directory and view files.
  1. cd /etc/letsencrypt/live/example.com
  2. ls

Files List:
cert.pem
chain.pem
fullchain.pem
privkey.pem

Setp 5 – Configure SSL VirtualHost

Use the following configurations for Apache and Nginx web server. Edit virtual host configuration file and add below entries for the certificate.

Apache:
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem


Step 6 – Configure SSL Auto Renew


In the end, configure the following job on your server crontab to auto-renew SSL certificate if required.

  1. 0 6 30 * * sudo /usr/sbin/certbot-auto -q renew

หรือ
  1. 0 6 30 * * certbot renew --dry-run



Step 7 นำไฟล์ไปใช้ ที่ 000-default.conf
เช่น
<VirtualHost *:80>
ServerName extranet.scivalve.com
Redirect / https://extranet.scivalve.com/
ServerAdmin suwit@scivalve.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =extranet.scivalve.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
ServerName extranet.scivalve.com
DocumentRoot /var/www/extranet
SSLEngine on
ServerAdmin suwit@scivalve.com
<Directory /var/www/extranet/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
SSLCertificateFile /etc/letsencrypt/live/extranet.scivalve.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/extranet.scivalve.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

https://tecadmin.net/install-lets-encrypt-create-ssl-ubuntu/

Ubuntu : Ubuntu 18.04 ส่ง log apace2 ไปเก็บที่ Log Server

Ubuntu : Ubuntu 18.04 ส่ง log apace2 ไปเก็บที่ Log Server
Ubuntu 18.04 Server มีการลง rsyslog มาให้อยู่แล้ว แก้แค่ Config

1. rsyslog.conf
  1. nano /etc/rsyslog.conf
แก้
#module(load="imudp")
#input(type="imudp" port="514")
ลบ # ออก
module(load="imudp")
input(type="imudp" port="514")

2. เพิ่ม ไฟล์ log ที่เราจะส่งไปเก็บ เช่น access.log, error.log, other_vhosts_access.log เป็นต้น
# Apache access file:

$ModLoad imfile
$InputFileName /var/log/apache2/access.log
$InputFileTag apache-access:
$InputFileStateFile stat-apache-access
$InputFileSeverity info
$InputRunFileMonitor

#Apache Error file:

$ModLoad imfile
$InputFileName /var/log/apache2/error.log
$InputFileTag apache-errors:
$InputFileStateFile stat-apache-error
$InputFileSeverity error
$InputRunFileMonitor
#Apache Other file;
$ModLoad imfile
$InputFileName /var/log/apache2/other_vhosts_access.log
$InputFileTag apache-other:
$InputFileStateFile stat-apache-other
$InputFileSeverity info
$InputRunFileMonitor

$InputFilePollInterval 10

if $programname == 'apache-access' then @@192.168.2.108:514
& ~
if $programname == 'apache-errors' then @@192.168.2.108:514
& ~
if $programname == 'apache-other' then @@192.168.2.108:514
& ~

# Forward syslog messages to Loggly
*.* @@192.168.2.108:514


วันอาทิตย์ที่ 24 พฤศจิกายน พ.ศ. 2562

Ubuntu : Ubuntu 18.04 Add Harddisk From Vmware

Ubuntu : Ubuntu 18.04 Add Harddisk From Vmware
1. Add disk edit Vmware
2. Check disk all root@intranet-test:~#
  1. fdisk -l 
Disk /dev/loop0: 88.5 MiB, 92778496 bytes, 181208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 43516ABD-068C-45F5-BC44-9BBBBAD0D4D2

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 104855551 104851456 50G Linux filesystem

Disk /dev/sdb: 150 GiB, 161061273600 bytes, 314572800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

3. Create disk
root@intranet-test:~#
  1. fdisk /dev/sdb
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old ext4 signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xbd682c0d.

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): #Enter
First sector (2048-314572799, default 2048): #Enter
Last sector, +sectors or +size{K,M,G,T,P} (2048-314572799, default 314572799):

Created a new partition 1 of type 'Linux' and of size 150 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

4. Convertor disk to ext4
  1. sudo mkfs -t ext4 /dev/sdb1
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 39321344 4k blocks and 9830400 inodes
Filesystem UUID: bf8171ec-a497-4ad8-80a0-aef19903721f
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
5 ดู Disk
  1. fdisk -l
Disk /dev/loop0: 88.5 MiB, 92778496 bytes, 181208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 43516ABD-068C-45F5-BC44-9BBBBAD0D4D2

Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 104855551 104851456 50G Linux filesystem

Disk /dev/sdb: 150 GiB, 161061273600 bytes, 314572800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbd682c0d

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 314572799 314570752 150G 83 Linux
6. ดู uuid เพื่อเอาไปใส่ใน fstab
  1. ls -al /dev/disk/by-uuid/

7. เพิ่ม uuid ใน fstab เพื่อให้ mount auto เมื่อเปิดเครื่อง
  1. nano /etc/fstab
UUID=bf8171ec-a497-4ad8-80a0-aef19903721f /www ext4 defaults 0 0
8. สร้าง Folder ที่จะ mount ไป ใน
  1. mkdir /www

9. reboot เครื่อง
10. Check ว่า disk ถูก Mount เรียบร้อย
  1. df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 395M 1.1M 394M 1% /run
/dev/sda2 49G 5.8G 41G 13% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/loop0 89M 89M 0 100% /snap/core/7270
/dev/sdb1 147G 61M 140G 1% /www
tmpfs 395M 0 395M 0% /run/user/1000
https://oxyme.wordpress.com/2018/08/29/add-install-a-new-hdd-on-ubuntu-18-04-lts-server-edition/

PHPBB3 : Install PHPBB3 V 3.0.12 On Ubuntu 18.04.3 และ Upgrade Version เป็น 3.0.14 รุ่นสุดท้าย

PHPBB3 : Install PHPBB3 V 3.0.12 On Ubuntu 18.04.3 และ Upgrade Version เป็น 3.0.14 รุ่นสุดท้าย
**** ไป Version 3.1 หรือ 3.2 ไม่ได้ เนื่องจาก ***
จาก 3.0 ไป 3.1 หรือ 3.2 ไม่ได้
1. MODs for 3.0.x are incompatible with 3.1.x and their functionality will be removed in the update process. Mod ที่จำเป็นต้องใช้ Blog Mod จะใช้ไม่ได้
2. Styles for 3.0.x cannot be installed or used on 3.1.x. Styles Template ไม่เข้ากัน
https://www.phpbb.com/community/viewtopic.php?t=2398876
https://www.phpbb.com/community/viewtopic.php?t=2402101

3. พบปัญหา PHP7 ถ้าจะใช้ Version 3.0 จะใช้ไม่ได้มี Bug
ถ้าใช้ PHP7.2 ไม่รองรับ 3.0 ต้อง 3.2 ถึงจะรองรับ PHP7
https://www.phpbb.com/customise/db/exte ... pic/162021
https://www.phpbb.com/community/viewtopic.php?t=2353436
https://www.phpbb.com/community/viewtop ... &t=2316556

Blog ไม่ขึ้น เมื่อใช้ที่ Version 3.0.12
เมื่อ Update เป็น 3.0.14 Blog ขึ้นแต่มี Error preg_replace() ใช้ไม่ได้
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 496: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4760: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4763: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)


ติดตั้ง Ubunt 18.04 และ PHPBB3 Version 3.0.12 เพื่อ Update เป็น 3.0.14
1. install Ubuntu 18.04.3 ต่อวง 0 เพื่อให้ได้ DHCP แล้วค่อยไปแก้ Network เป็น วง 2
2. copy config เดิมไว้ก่อน
  1. cp /etc/netplan/50-cloud-init.yaml 50-cloud-init.yaml.Backup
3. แก้ Network Fix IP เป็นวง 2
  1. nano /etc/netplan/50-cloud-init.yaml

  1. network:
  2.    version: 2
  3.    renderer: networkd
  4.    ethernets:
  5.       ens160:
  6.          addresses: [192.168.2.114/24]
  7.          gateway4: 192.168.2.2
  8.          nameservers:
  9.             addresses: [8.8.8.8,8.8.4.4,192.168.2.2]

4. Run netplan apply หรือ reboot
5. แก้ apt.conf
  1. nano /etc/apt/apt.conf
Acquire::http { Proxy "http://192.168.2.106:9999"; };
บาง update ไม่ได้ไม่มี Sources ใน 2.106 ให้ปิด apt.conf ไว้ แล้ว update upgrade ใหม่

6. Up และ Set locale
  1. apt-get update
  2. apt-get upgrade
  3. locale-gen en_US en_US.UTF-8 th_TH th_TH.UTF-8

7. Set time zome
  1. sudo timedatectl set-timezone Asia/Bangkok

ดู Time zone
  1. cat /etc/timezone

8. ติดตั้ง ntp
apt install ntp
nano /etc/ntp.conf
เพิ่ม
pool 192.168.2.2
  1. /etc/init.d/ntp restart
  2. ntpq -pn

ดูเวลาที่ sync มา
  1. date

9. สำคัญ ต้องติดตั้ง php5.6 เพื่อใช้งานจะได้ไม่มีปัญหา ตาม Blog
blog.php?u=3&b=1612

10. Database
  1. sudo apt-get install mysql-server


11. Creating phpBB Database and User
  1. sudo mysql -u root -p

ใส่รหัส mysql
เปลี่ยนรหัส root ถ้าจะใช้ root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xxxxx';

หรือ สร้าง user ใหม่
Create user 'sa'@'localhost' IDENTIFIED BY 'xxxxx';
  1. flush privileges;
  2. exit;


12. ติดตั้ง Phpmyadmin
  1. apt-get install phpmyadmin

เลือก apache
จะสร้าง user phpmyadmin ให้
ใส่รหัส 2 ครั้ง
ลองเข้า
192.168.2.114/phpmyadmin

ด้วย user root ในข้อ 11 หรือ user phpmyadmin ก็ได้

13. นำไฟล์ phpbb3_3.0.12 เข้าเครื่อง download มาหรือ wget มา หรือลง ftp เอาก็ได้
ในไฟล์ไปที่ www แล้วแตกไฟล์

14. ติดตั้งตามขึ้นตอนข้อที่ 19.
https://intranet.sci.com/blog.php?u=281&b=1750

15. จะเข้า Ldap ไม่ได้ จะเป็นหน้า ขาว Bug phpbb3
ดู log จะพบ
  1. tail -f /var/log/apache2/error.log
[Sat Nov 23 10:03:57.894290 2019] [:error] [pid 4332] [client 192.168.0.244:49572] PHP Fatal error: Cannot redeclare ldap_escape() in /var/www/html/includes/auth/auth_ldap.php on line 300, referer: http://192.168.2.114/adm/index.php?sid= ... 215f59d847

วิธีแก้

แก้ไฟล์ auth_ldap.php อยู่ใน Floder includes
/**
* Escapes an LDAP AttributeValue
*/
if (!function_exists('ldap_escape'))
{
function ldap_escape($string)
{
return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string);
}
}

https://www.phpbb.com/community/viewtopic.php?t=2263381

16. ใส่ข้อมูล ldap แล้วไม่ผ่าน Error
Information
Could not find a login identity for admin.
ชื่ออื่นจะไม่ผ่าน login admin ต้องใช้ user administrator เท่านั้น
Information
The specified e-mail attribute does not exist.
ใส่ mail ไม่ผ่าน ไม่ต้องใส่ ถึงจะผ่าน
17. ทดลอง login user domain
18. นำ Database เก่ามา restore database sci_phpbb
จะเอาเข้าไม่ได้เพราะ file ใหญ่
ต้องแก้
  1. nano /etc/php/5.6/apache2/php.ini
แก้ 3 ค่า
upload_max_filesize = 50M
post_max_size = 50M
max_file_uploads = 50
restart apache
  1. /etc/init.d/apache2 restart
สร้าง database sci_phpbb แล้วนำ database เก่ามา Restore

19. ทดลอง copy file จากเครื่องเดิม ยกเว้น sci, file, _install_ ทดลองก่อนยังไม่ต้องเอามาเพราะไฟล์พวกนี้ใหญ่และเยอะ
copy inculde ต้องแก้ auth_ldap.php ตามด้านบนข้อ 15 ด้วย ไม่งั่นจะจอขาว
เอาไฟล์จากเครื่องจริงมาทับ

20. ทดลองเข้าดูจะต้องเข้าได้ก่อน และ Login ได้ แต่เมนูด้านข้างจะไม่มี
ต้อง เข้า ACP ไป Restart Template และ Teme ก่อน ข้อมูลต่าง ๆ Menu Link Blog ก็จะกลับมา พร้อมใช้งาน
ถ้ามีหน้าขาวว่างปล่างต้องดู log ว่ามี Error อะไร

21. Step Upgrade 3.0.12 --> 3.0.14
1. แตกไฟล์ 3.0.14 full ที่ Download มา https://download.phpbb.com/pub/release/3.0/3.0.14/
2. นำ Floder install ไปว่างไว้ใน /var/www/html (หรือ Floder อื่น Root ของ Apache และกำหนด สิทธ์ www-data และ 775)
3. เข้า 192.168.2.114/install/database_update.php
4. ลบหรือเปลี่ยนชื่อ install folder

21. สร้าง Database และนำ Database มา restore database sci และ อื่นๆ ที่จะใช้ แล้วค่อยทดลอง copy ใน Folder sci มาจะนาน
และ copy file มาด้วย
เสร็จขึ้นตอนการ Update ทดลอง ดู Menu ต่าง ๆ อาจจะมี Error ค่อยแก้



PHPmyadmin Error เพราะ Bug php.ini ที่พบตอนจะ Restore

PHPmyadmin Error เพราะ Bug php.ini ที่พบตอนจะ Restore Database พบ 2 Case
1.
Warning in ./libraries/plugin_interface.lib.php#551
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/display_import.lib.php#371: PMA_pluginGetOptions(
string 'Import',
array,
)
./libraries/display_import.lib.php#456: PMA_getHtmlForImportOptionsFormat(array)
./libraries/display_import.lib.php#691: PMA_getHtmlForImport(
string '5dd649bc92f3e',
string 'database',
string 'sci_phpbb',
string '',
integer 8388608,
array,
NULL,
NULL,
string '',
)
./db_import.php#43: PMA_getImportDisplay(
string 'database',
string 'sci_phpbb',
string '',
integer 8388608,
)

วิธีแก้
  1. nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php
  1. ctrl+w
count($options)
if ($options != null && count($options) > 0) {
แก้เป็น
if ($options != null && count((array)$options) > 0) {

2.
Warning in ./libraries/sql.lib.php#613
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/sql.lib.php#2128: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#2079: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'sci_phpbb',
string 'phpbb_blogs_plugins',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `phpbb_blogs_plugins`',
NULL,
NULL,
)
./sql.php#221: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'sci_phpbb',
string 'phpbb_blogs_plugins',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `phpbb_blogs_plugins`',
NULL,
NULL,
)

วิธีแก้
  1. nano /usr/share/phpmyadmin/libraries/sql.lib.php

go to line 613
|| (count($analyzed_sql_results['select_expr'] == 1)
&& ($analyzed_sql_results['select_expr'][0] == '*')))
&& count($analyzed_sql_results['select_tables']) == 1;
แทนที่ด้วย
|| count($analyzed_sql_results['select_expr']) == 1
&& ($analyzed_sql_results['select_expr'][0] == '*'))
&& count($analyzed_sql_results['select_tables']) == 1;

แล้ว Restart apache
  1. /etc/init.d/apache2 restart


Fix Bug Phpmyadmin [plugin_interface.lib.php] + Php7.2 + Ubuntu 18.04
http://libtechnophile.blogspot.com/2019/08/m.html
https://medium.com/@chaloemphonthipkasorn/%E0%B9%81%E0%B8%81%E0%B9%89-bug-phpmyadmin-php7-2-ubuntu-16-04-92b287090b01