From ElectroDragon
Revision as of 10:46, 1 December 2019 by Chao (talk | contribs) (PHP)
Jump to navigation Jump to search


Type PHP -
Debian 9/8 5.6 -
Ubuntu 17/16 7 -
  • Reference from here LEMP


  • sudo apt-get install mysql-server
  • sudo mysql_secure_installation -> after set root pass, all the rest set to Y


  • apt-get install mysql-server mysql-client

You will be asked to provide a password for the MySQL root user - this password is valid for the user root@localhost as well as, so we don't have to specify a MySQL root password manually later on.

Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

apt-cache search php5

Pick the ones you need and install them like this:

apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Xcache is a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It's similar to other PHP opcode cachers, such as eAccelerator and APC. It is strongly recommended to have one of these installed to speed up your PHP page.

Xcache can be installed as follows:

apt-get install php5-xcache

and let's restart the php by doing:

service php5-fpm restart

Now we should see many extra modules you installed in the phpinfo.php, including the mysql.




  • Debug -> vim /etc/php5/fpm/pool.d/www.confMake necessary changes to match following values:
slowlog = /var/log/php5/slow.log
request_slowlog_timeout = 10s

MYSQL debug

  • enter into shell -> mysql -u root -p
  • Enable log -> set global slow_query_log = 'ON';
  • Set log address -> set global slow_query_log_file ='/var/log/mysql/slow-query.log';

the rest debug

  • Use wordpress plugin Query Monitor
  • Use WP Debug
 * For developers: WordPress debugging mode.
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
define('WP_DEBUG', true);
define('SAVEQUERIES', true);


  • ufw app list


  • ngxtop


docker run -d -p 80:80 --name=mynginx -v $PWD/html:/usr/share/nginx/html nginx

  • -d daemon -p port, --name, -v volume
  • docker pull nginx
  • Basic
docker container run \
 -d \
 -p \
 --rm \
 --name mynginx \
  • -d daemon, -p port, --rm remove after close --name name
  • stop it - docker container stop mynginx
  • mkdir Nginx_files cd and mkdir html
  • nano index.html write <h1>Hello World</h1>
  • V2
docker container run \
 -d \
 -p \
 --rm \
 --name mynginx \
 --volume "$PWD/html":/usr/share/nginx/html \
  • copy config file -> docker container cp mynginx:/etc/nginx .
  • copy folder nginx to current folder .
  • Other files
  • enter into docker -> docker exec -it nginx /bin/bash


  • Gitlab
  • Seafile


Webfiles side

Header text Header text Header text
1. create config file
  • nano /etc/rsyncd.conf
2. Config
uid = nobody
gid = nobody
use chroot = no
max connections = 10
strict modes = yes
pid file = /var/run/
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
path = /backup/
comment = backup file
ignore errors 
read only = no
write only = no
hosts allow = *
hosts deny =
list = false
uid = root
gid = root
auth users = backup
secrets file = /etc/server.pass
  • backup user name backup
  • backup pass at /etc/server.pass
  • backup module [bk_files], inside folder is /backup/
3. create secrete files
  • nano pass
  • backup:password
  • chmod 666 pass
  • maybe restart rsync --daemon
  • backup:password, user name and pass

Backup side

Steps Header text Header text
1. create secrete file
  • nano server.pass, and then type pass
  • chmod 600 server.pass
2. Main command
  • rsync -azvi --delete --progress backup@ /backup/ --password-file=/backup/
  • rsync -azvi --delete --progress backup@ /backup/ --password-file=/backup/
3. Note config
  • -azvi
  • --delete delete file on this side
  • --progress show transfer progress
  • --exclude "*access*" --exclude "debug", exclude files
  • backup is rsync user name
  • remote server
  • bk_files is backup module
  • /backup/ local folder
  • --password-file=/etc/server.pass, use pass
4. setup cronteb -e
  • 00 01 * * * rsync -azvi --delete --progress backup@ /backup/ --password-file=/backup/server.pass


Type alexa - prerequisite
vanilla 72K github - 1.7K PHP7
Carbon forum 687K github - 1.25K
phpbb 42K free
nodebb 189K github
smf 69K free
mybb 68K free
woltlab 115K free
discourse 35K github 2GB RAM min.
flarum 119K beta version now
fluxbb 661K non-free
IPS Board 44K non-free
xenforo 39K non-free
vbulletin 67K non-free


Reference tutorial

Pages in category "Website"

This category contains only the following page.