Langsung ke konten utama

Postingan

PHP Apps in a Subdirectory in Nginx

 location /pilkades {     alias /var/www/html/pilkades;     try_files $uri $uri/ @nested;     location ~ \.php$ {         include snippets/fastcgi-php.conf;         fastcgi_param SCRIPT_FILENAME $request_filename;         fastcgi_pass unix:/run/php/php7.4-fpm.sock;     } } location @pilkades {     rewrite /pilkades/(.*)$ /pilkades/index.php?/$1 last; } atau: location /alias {     alias  /var/www/htmlalias;     location ~ /([^/]+\.php)$ {       try_files /$1 =404;       fastcgi_pass unix:/var/run/php5-fpm.sock;       fastcgi_index index.php;       include fastcgi_params;       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;     }   }
Postingan terbaru

Fix rpmdb: Thread died in Berkeley DB library Centos

Ketika dapat error seperti ini  rpmdb: Thread/process 277623/140429100390144 failed: Thread died in Berkeley DB library error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db3 -  (-30974) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.verbose.cli.yumcompletets:Yum Error: Error: rpmdb open failed Dapat difixkan dengan cara: mkdir /var/lib/rpm/backup cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/ rm -f /var/lib/rpm/__db.[0-9][0-9]* rpm --quiet -qa rpm --rebuilddb yum clean all

Backup Mysql ALL Database with Specific Methods ( #! /bin/bash)

#! /bin/bash # backup-mysql.sh # # Craig Sanders <cas@taz.net.au> # this script is in the public domain.  do whatever you want with it. MYUSER="root" MYPWD="PASSWD" ARGS="--single-transaction --flush-logs --complete-insert" DATABASES=$( mysql -D mysql --skip-column-names -B -e 'show databases;' | egrep -v 'information_schema' ); BACKUPDIR=/var/backups/mysql YEAR=$(date +"%Y") MONTH=$(date +"%m") DAY=$(date +"%d") DATE="$YEAR-$MONTH/$YEAR-$MONTH-$DAY" mkdir -p $BACKUPDIR/$DATE cd $BACKUPDIR/$DATE for i in $DATABASES ; do   echo -n "backing up $i: schema..."   mysqldump $ARGS --no-data -u$MYUSER -p$MYPWD $i > $i.schema.sql   echo -n "data..."   mysqldump $ARGS --skip-opt --no-create-db --no-create-info -u$MYUSER -p$MYPWD $i > $i.data.sql   echo -n "backup full databases"   mysqldump $ARGS -u$MYUSER -p$MYPWD $i > $i.full.sql   echo -n "Backup views"

Backup database MYSQL (data only, dll)

Backup Data only: mysqldump  -u root -p --protocol=tcp --port=3306 --default-character-set=utf8 --single-transaction=TRUE --skip-triggers DATABASE -t table1 -t table2 -t table3  > data.sql Backup Structure only: mysqldump --no-data -u root -p Database table1 table2 ... > str.sql Backup Data and Structure : mysqldump -u root -p Database -t table -t table ... > data&struk.sql Backup Structure view only: mysql -h hosts -u usernonroot -ppassword --skip-column-names --batch -e "select concat('drop table if exists ', table_schema, '.', table_name,'; create or replace view ', table_schema, '.', table_name, ' as ', view_definition, '; ') as q from information_schema.views where table_schema = 'DATABASE_NAME' " > views.sql && sed -i 's/usernonroot/usernonrootnew/g' views.sql Backup Procedure and Function Only: mysqldump -u root -p -single-transaction=TRUE --routines --no-data --no-create-info=TRUE

Switch PHP version

Interactive switching mode sudo update-alternatives --config php Manual Switching From PHP 5.6 => PHP 7.1 Default PHP 5.6 is set on your system and you need to switch to PHP 7.1. Apache: $ sudo a2dismod php5 . 6 $ sudo a2enmod php7 . 1 $ sudo service apache2 restart Command Line: $ sudo update - alternatives -- set php / usr / bin / php7 . 1 From PHP 7.1 => PHP 5.6 Default PHP 7.1 is set on your system and you need to switch to PHP 5.6. Apache: $ sudo a2dismod php7 . 1 $ sudo a2enmod php5 . 6 $ sudo service apache2 restart Command Line: $ sudo update - alternatives -- set php / usr / bin / php5 . 6

Mengatasi Error DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled

Jika di mysql mendapatkan error seperti dibawah ini: 1418 (HY000) at line 10185: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) dapat diselesaikan dengan cara: 1. jalan kan di cmd/terminal: SET GLOBAL log_bin_trust_function_creators = 1; 2. Masukan di konfgurasi my.cnf : log_bin_trust_function_creators = 1;