Sunday, November 29, 2015

How To - Migrate Wordpress From Localhost to Production Server

1. Export local MYSQL database and import to MYSQL (production server).

2. Upload all localhost wordpress into you production server directory.

3. Change DB_NAME, DB_USER and DB_PASSWORD inside wp-config.php

4. Open wordpress database using MySQL tool (such PhpMyAdmin) and execute this SQL query:
UPDATE wp_options 
 SET option_value = replace(option_value, 'http://localhost/word_press', '') 
WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts 
 SET post_content = replace(post_content, 'http://localhost/word_press', '');
UPDATE wp_postmeta 
 SET meta_value = replace(meta_value,'http://localhost/word_press','');
* Note : Please replace "" with you new wordpress URL location.

5.Login and go to the admin dashboard of your new website and browse to Settings > Permalinks. Select the structure you used for your local installation and save.

6. Done !

Tuesday, November 24, 2015

Fedora - Tomcat server

 $ sudo dnf install tomcat tomcat-webapps tomcat-admin-webapps tomcat-docs-webapp tomcat-javadoc
 $ sudo systemctl start tomcat.service
 $ sudo lsof -i :8080  
 java  9006 tomcat  49u IPv6 81129   0t0 TCP *:webcache (LISTEN)  
$ sudo gedit /etc/tomcat/tomcat-users.xml 
<?xml version='1.0' encoding='utf-8'?>
 <role rolename="manager-gui"/>
 <user username="tomcat" password="tomcat" roles="tomcat, manager-gui"/>
 <role rolename="admin"/> 
 <user username="admin" password="admin" roles="admin,manager,manager-gui"/>

Monday, November 23, 2015

Linux - Check wireless card capabilities

$ iw dev
Interface wlp2s0
ifindex 3
wdev 0x1
addr 6x:1x:43:2x:97:x3
type managed
channel 6 (2437 MHz), width: 20 MHz (no HT), center1: 2437 MHz

$ iw phy phy0 info
Wiphy phy0
max # scan SSIDs: 20
max scan IEs length: 195 bytes
max # sched scan SSIDs: 0
max # match sets: 0
Retry short limit: 7
Retry long limit: 4
Coverage class: 0 (up to 0m)
Device supports RSN-IBSS.
Supported Ciphers:
* WEP40 (00-0f-ac:1)
* WEP104 (00-0f-ac:5)
* TKIP (00-0f-ac:2)
* CCMP (00-0f-ac:4)
* 00-0f-ac:10
* GCMP (00-0f-ac:8)
* 00-0f-ac:9
Available Antennas: TX 0 RX 0
Supported interface modes:
* managed
* AP
* monitor
Band 1:
Capabilities: 0x1072
Static SM Power Save
RX Greenfield
Max AMSDU length: 3839 bytes
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 4 usec (0x05)
HT Max RX data rate: 300 Mbps
HT TX/RX MCS rate indexes supported: 0-15
Bitrates (non-HT):
* 1.0 Mbps
* 2.0 Mbps (short preamble supported)
* 5.5 Mbps (short preamble supported)
* 11.0 Mbps (short preamble supported)
* 6.0 Mbps
* 9.0 Mbps
* 12.0 Mbps
* 18.0 Mbps
* 24.0 Mbps
* 36.0 Mbps
* 48.0 Mbps
* 54.0 Mbps
* 2412 MHz [1] (16.0 dBm)
* 2417 MHz [2] (16.0 dBm)
* 2422 MHz [3] (16.0 dBm)
* 2427 MHz [4] (16.0 dBm)
* 2432 MHz [5] (16.0 dBm)
* 2437 MHz [6] (16.0 dBm)
* 2442 MHz [7] (16.0 dBm)
* 2447 MHz [8] (16.0 dBm)
* 2452 MHz [9] (16.0 dBm)
* 2457 MHz [10] (16.0 dBm)
* 2462 MHz [11] (16.0 dBm)
* 2467 MHz [12] (16.0 dBm) (no IR)
* 2472 MHz [13] (16.0 dBm) (no IR)
Supported commands:
* new_interface
* set_interface
* new_key
* start_ap
* new_station
* new_mpath
* set_mesh_config
* set_bss
* authenticate
* associate
* deauthenticate
* disassociate
* join_ibss
* join_mesh
* set_tx_bitrate_mask
* frame
* frame_wait_cancel
* set_wiphy_netns
* set_channel
* set_wds_peer
* probe_client
* set_noack_map
* register_beacons
* start_p2p_device
* set_mcast_rate
* set_qos_map
* connect
* disconnect
Supported TX frame types:
* IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
* P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
Supported RX frame types:
* IBSS: 0x40 0xb0 0xc0 0xd0
* managed: 0x40 0xd0
* AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* mesh point: 0xb0 0xc0 0xd0
* P2P-client: 0x40 0xd0
* P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
* P2P-device: 0x40 0xd0
WoWLAN support:
* wake up on disconnect
* wake up on magic packet
* wake up on pattern match, up to 20 patterns of 16-128 bytes,
maximum packet offset 0 bytes
* can do GTK rekeying
* wake up on GTK rekey failure
* wake up on EAP identity request
* wake up on rfkill release
software interface modes (can always be added):
* monitor
valid interface combinations:
* #{ managed } <= 1, #{ AP } <= 1,
total <= 2, #channels <= 1, STA/AP BI must match
* #{ managed } <= 2,
total <= 2, #channels <= 1
HT Capability overrides:
* MCS: ff ff ff ff ff ff ff ff ff ff
* maximum A-MSDU length
* supported channel width
* short GI for 40 MHz
* max A-MPDU length exponent
* min MPDU start spacing
Device supports TX status socket option.
Device supports HT-IBSS.
Device supports SAE with AUTHENTICATE command
Device supports scan flush.
Device supports per-vif TX power setting
Driver supports a userspace MPM
Device supports static SMPS
Device supports dynamic SMPS
Device supports configuring vdev MAC-addr on create.

WPS / King Office - Some formula symbols might not be display correctly due to missing fonts: Wingdings, Wingdings 2, Wingdings 3 (FIXED)

I just installed WPS on my machine.. and received a warning said :
Some formula symbols might not be display correctly due to missing fonts: Wingdings, Wingdings 2, Wingdings 3

Well, this warning still exist since the earlier Alpha version that I tested 1 years ago. I don't know why they still didn't fix this problem. Here, I share how to fix this problem :
$ cd ~/.fonts
$ wget -c
$ unzip
$ rm
$ sudo fc-cache -vf

Thursday, November 19, 2015

SELinux - Check http boolen status

$ sudo getsebool -a | grep httpd
httpd_anon_write --> off
httpd_builtin_scripting --> on
httpd_can_check_spam --> off
httpd_can_connect_ftp --> off
httpd_can_connect_ldap --> off
httpd_can_connect_mythtv --> off
httpd_can_connect_zabbix --> off
httpd_can_network_connect --> on
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> on
httpd_can_network_memcache --> off
httpd_can_network_relay --> off
httpd_can_sendmail --> off
httpd_dbus_avahi --> off
httpd_dbus_sssd --> off
httpd_dontaudit_search_dirs --> off
httpd_enable_cgi --> on
httpd_enable_ftp_server --> off
httpd_enable_homedirs --> off
httpd_execmem --> off
httpd_graceful_shutdown --> on
httpd_manage_ipa --> off
httpd_mod_auth_ntlm_winbind --> off
httpd_mod_auth_pam --> off
httpd_read_user_content --> off
httpd_run_ipa --> off
httpd_run_preupgrade --> off
httpd_run_stickshift --> off
httpd_serve_cobbler_files --> off
httpd_setrlimit --> off
httpd_ssi_exec --> off
httpd_sys_script_anon_write --> off
httpd_tmp_exec --> off
httpd_tty_comm --> off
httpd_unified --> off
httpd_use_cifs --> off
httpd_use_fusefs --> on
httpd_use_gpg --> off
httpd_use_nfs --> off
httpd_use_openstack --> off
httpd_use_sasl --> off
httpd_verify_dns --> off

Tuesday, November 17, 2015

Fedora - Installing RabbitVCS

$ sudo dnf install python-simplejson rabbitvcs*
$ nautilus -q

PHP / MySQL - Converting a Date to MySql Formatted Date

function dateconvert($date,$func) {
    if ($func == 1){ //insert conversion
      list($day, $month, $year) = split('[/.-]', $date); 
      $date = "$year-$month-$day"; 
      return $date;
    if ($func == 2){ //output conversion
      list($year, $month, $day) = split('[-.]', $date); 
      $date = "$day/$month/$year"; 
      return $date;
Credit :

Fedora - Enable htaccess rules by AllowOverride setting

Peace be upon you, by default Apache is configured to ignore some or all directives in .htaccess files. This is for security reasons. The AllowOverride directive controls which features will be allowed in .htaccess files. For example AllowOverride None can turn off htaccess files for a folder and its subfolders. All you need it to setting Apache web server configuration file.
# vi /etc/httpd/conf/httpd.conf
Then go to line 151 and change AllowOverride None with AllowOverride All.

Next, reload you Apache webserver with new setting
# systemctl restart httpd.service

Sunday, November 15, 2015

Form File Upload Limits With PHP

$arrayMaxes = array(
    'upload_max_filesize' => intval(ini_get('upload_max_filesize')),
    'post_max_size' => intval(ini_get('post_max_size')),
    'memory_limit' => intval(ini_get('memory_limit'))
$maxUploadSize = min($arrayMaxes);
foreach ($arrayMaxes as $key => $value) {
    if ($value == min($arrayMaxes)) {
        $minimumOfThree = $key;

echo "The maximum file size you can upload is $maxUploadSize, this is due to the php.ini setting $mininimumOfThree";

Credit :

PhpMyAdmin - Login without a password is forbidden by configuration (see AllowNoPassword)

You need to turn on the option AllowNoPassword on file /etc/phpMyadmin/ Simply run :
$ sudo vim /etc/phpMyAdmin/
and change AllowNoPassword from FALSE to TRUE:
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

Saved, then you can access phpMyAdmin without password.

Saturday, November 14, 2015

Fedora 23 - LAMP - Linux, Apache, MySQL And PHP

Currently, I'm using Gnu/Linux Fedora 23 Gnome. I need to setup a working LAMP environment but I not familiar yet with RPM based distro and after some research, I figure out this tutorial.

First thing, you need to update your repository at first :
$ sudo dnf update
Then, lets begin to install Apache web server and MySQL database server (Not familiar with Nginx dan MariaDB yet):
$ sudo dnf install httpd
$ sudo dnf install community-mysql-server
Now install PHP engine
$ sudo dnf install php php-mysql
Do you need PhpMyAdmin? I always need that
$ sudo dnf install phpmyadmin 
* Tutorial : Allow no password on PhpMyAdmin

Start Apache and MySQL services via systemctl:
$ sudo systemctl start httpd.service
$ sudo systemctl start mysqld.service
If you are using Gnome desktop enviroment, I recommend you to install this LAMP status extension :

By default web server is only accessible as localhost. To allow access publicly to the LAMP over HTTP and HTTPS, you need to configure the firewall rules and after that reboot or reload the firewall:
$ sudo firewall-cmd --permanent --add-service=http
$ sudo firewall-cmd --permanent --add-service=https
$ sudo firewall-cmd --reload 

Linux - Restart network after updating DNS

$ sudo systemctl restart NetworkManager
$ cat /etc/resolv.conf

Friday, November 13, 2015

Fedora 23 - Install fendy with WGET

Well, I don't like cURL. Because of my company proxy setting. So I made a custom Fedy installer that use wget..

# Script to install Fedy < >.
# Copyright (C) 2014  Satyajit sahoo
# Custom by kriptonium - 13/11/2015

if [[ ! $(whoami) = "root" ]]; then
    echo "Please run the script as root."
    exit 1

echo "Downloading RPM files.."
wget$(rpm -E %fedora)/RPMS/noarch/folkswithhats-release-1.0.1-1.fc$(rpm -E %fedora).noarch.rpm
wget$(rpm -E %fedora).noarch.rpm
wget$(rpm -E %fedora).noarch.rpm

echo "Adding repositories..."
rpm --quiet --query folkswithhats-release || dnf -y --nogpgcheck install folkswithhats-release-1.0.1-1.fc$(rpm -E %fedora).noarch.rpm
rpm --quiet --query rpmfusion-free-release || dnf -y --nogpgcheck install rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
rpm --quiet --query rpmfusion-nonfree-release || dnf -y --nogpgcheck install rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

echo "Installing fedy..."

dnf -y --nogpgcheck install fedy

echo "Delete RPM files.."
rm folkswithhats-release-1.0.1-1.fc$(rpm -E %fedora).noarch.rpm
rm rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
rm rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# Please report bugs at < >
# End of the Script

$ wget
$ sudo chmod +x fedy-installer-custom
$ sudo ./fedy-installer-custom

Fedora : DNF with proxy

# dnf update
Error: Failed to synchronize cache for repo 'fedora' from '': Cannot prepare internal mirrorlist: Curl error (28): Timeout was reached for [Connection timed out after 120000 milliseconds]

Currently, I using Gnu/Linux Fedora 23. If you are working behind a proxy server just like me, then you have to edit the file /etc/dnf/dnf.conf so that DNF can know which proxy setting to use.

# gedit etc/dnf/dnf.conf

Then add proxy=http://proxy:port at end of the file. Example :


Tuesday, November 10, 2015

Snippet - My Bahasa Malaysia Bootstrap data table

Peace be upon you,

Bootstrap table with Data Tables

I am fan of bootstrap design for my website design. But I still need another scripting for my table component which is about filter, sort and navigation. DataTable are my favorites script. It keep my HTML table so clean and breeze. Here, I share with you, my personal language configuration in Malay:

<script type="text/javascript">
        $('#bootstrap-table').dataTable( {
            "ordering": false,
            "language": {
                "search": "Carian:",
                paginate: {first:    '<<',previous: '<<',next:     '>>',last:     '>>'},
                "info": "Paparan halaman _PAGE_ daripada _PAGES_ halaman",
                "lengthMenu": "Lihat _MENU_ rekod per halaman",
                "infoEmpty":      "",
                "infoFiltered":   "(Tapisan carian daripada _MAX_ rekod maklumat)",
                "zeroRecords":    "Tiada padanan carian di temui"
        } );

Kudos for Datatables for this excellent and wonderful add-on to my bootstrap design :)

Sunday, November 8, 2015

XAMPP : Automate MySQL database backup

Well, this is a simple script that allow you to backup MySQL database on Windows. I just ripped off several code on internet and make my own version. Such a script kiddie, huh? Wait, If you let this script run with Windows Task Scheduler in certain time, it will be automate MySQL database backup, Wohaa. Read this beruk bodo as you references. Plus, this script use 7zip to compress the SQL file which quite useful to save the our precious disk usage (Download here). Change thus variable (at line 11-16) with you own setting, before execute this script. Each backup are saved in separated directory, sort by date and time during backup process ..That all, K..bye!

Tuesday, November 3, 2015

Problem :
Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\dev\session.php on line 3

Solution : Open session.php and replace session_start();(line 3) with this code

Sunday, November 1, 2015

XAMPP - Mailer Error: Extension missing: openssl

I helped my friend to build a web based system and we have a features that allow system to send new password if users forgot they password. I use PhpMailer class for the mailing function. On top of that, we use stack XAMPP as our production playground. Then I found this problem :
Mailer Error: Extension missing: openssl

After some google-fu, I need to enable OpenSSL extension from my PHP configuration file. So, just open C:/xampp/php/php.ini with you favorite text editor such notepad++, sublime-text or else. Then goto line 636 and remove ; and just left extension=php_openssl.dll and save your files. Now restart Apache, MySQL services and problem solved.