Thursday, February 9, 2017

Install memcache for php 5.6.30

My environment:

PHP: version 5.6.30
Xampp:
Xampp version: 3.2.2 (x86)
Xampp Directory: C:\xampp
MariaDB: version 10.1.21

My problem:

I use framework yii 1.1.15 to develop my application. I have problem with MemCache. I try to fix it.








My Solution:

Step 1: Download php_memcache-3.0.8-5.6-ts-vc11-x86.zip from http://windows.php.net/downloads/pecl/releases/memcache/3.0.8/
Step 2: Extract the file in Step 1, then copy php_memcache.dll to C:\xampp\php\ext
and copy example.php, memcache.php to C:\xampp\htdocs
Step 3: Open file php.ini in C:\xampp\php directory, add following lines:

extension=php_memcache.dll
[Memcache]
memcache.allow_failover = 1
memcache.max_failover_attempts=20
memcache.chunk_size =8192
memcache.default_port = 11211


Step 4: Restart apache
Step 5: Testing memcache, access http://localhost/example.php 
OR create a file info.php, insert following lines:
phpinfo();?>
Check http://localhost/info.php



Friday, September 23, 2016

Migrate MyISAM tables to INNODB using mysqldump


In this article you will find information how to convert MyISAM tables to INNODB. 
The procedure here is an offline procedure, i.e, you cannot have changes on the SOURCE database, while you do this. A better way could be to setup replication between the SOURCE and the TARGET, but that is not described here.

On the source database

In this example we dump out the database mydb into mydb_schema.sql and mydb_data.sql
mysqldump -uroot -p --no-data  -R --triggers mydb > mydb_schema.sql
Then dump out the data:
mysqldump -uroot -p --no-create-info  -R --triggers mydb > mydb_data.sql

Change Storage Engine

You must verify first you don't have any MYISAM tables with FULLTEXT, since innodb only supports FULLTEXT from MySQL version 5.6.
If you have FULLTEXT indexes, then change manually all but the full text tables to innodb (not shown here).
sed -i.bak 's#MyISAM#innodb#g' mydb_schema.sql

On the TARGET database server

Create the database on the target database server and load in the dump into the database mydb:
# create the database
mysql -uroot -p -e "create database mydb" 
# create the schema
mysql -uroot -p mydb < mydb_schema.sql 
# load in the data
mysql -uroot -p mydb < mydb_data.sql

Monday, August 22, 2016

How to rename datafiles in Oracle 11g

[Problem] 

I want to rename datafile E:\ORACLE\VNPT\DATAFILE\O1_MF_EXAMPLE_CVNONK37_.DBF to E:\ORACLE\VNPT\DATAFILE\EXAMPLE.DBF

[FIX]

D:\Users\Administrator>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 22 09:48:56 2016

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------

E:\ORACLE\VNPT\DATAFILE\O1_MF_SYSTEM_CVNOJMJ1_.DBF
E:\ORACLE\VNPT\DATAFILE\O1_MF_SYSAUX_CVNOJXF6_.DBF
E:\ORACLE\VNPT\DATAFILE\O1_MF_UNDOTBS1_CVNOK3LH_.DBF
E:\ORACLE\VNPT\DATAFILE\O1_MF_USERS_CVNOK42T_.DBF
E:\ORACLE\VNPT\DATAFILE\O1_MF_EXAMPLE_CVNONK37_.DBF

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host move E:\ORACLE\VNPT\DATAFILE\O1_MF_EXAMPLE_CVNONK37_.DBF E:\ORACLE\VNP
T\DATAFILE\EXAMPLE.DBF;
        1 file(s) moved.

SQL> startup mount;
ORACLE instance started.

Total System Global Area  535662592 bytes
Fixed Size                  1375792 bytes
Variable Size             436208080 bytes
Database Buffers           92274688 bytes
Redo Buffers                5804032 bytes
Database mounted.
SQL> alter database rename file 'E:\ORACLE\VNPT\DATAFILE\O1_MF_EXAMPLE_CVNONK37_
.DBF' to 'E:\ORACLE\VNPT\DATAFILE\EXAMPLE.DBF';

Database altered.

SQL> alter database open;

Database altered.

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------

E:\ORACLE\VNPT\DATAFILE\O1_MF_SYSTEM_CVNOJMJ1_.DBF
E:\ORACLE\VNPT\DATAFILE\O1_MF_SYSAUX_CVNOJXF6_.DBF
E:\ORACLE\VNPT\DATAFILE\O1_MF_UNDOTBS1_CVNOK3LH_.DBF
E:\ORACLE\VNPT\DATAFILE\O1_MF_USERS_CVNOK42T_.DBF
E:\ORACLE\VNPT\DATAFILE\EXAMPLE.DBF

SQL>

Tuesday, August 2, 2016

How to fix "This installation package could not be opened..."

Describe:

















FIXED:

Step 1: Start / Run / regedit





Step 2: Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

Step 3: Find Dword NtfsDisable8dot3NameCreation and Win31FileSystem














Step 4: Modify them to 0

























Step 5: Reboot your machine and retry install 

Friday, June 10, 2016

How to kill all session Xvnc

 

Step 1: List all processes of Xvnc

[root@VTGDB.COM tmp]# ps -ef | grep Xvnc
root     112273      1  1 14:22 pts/0    00:00:00 /usr/bin/Xvnc :1 -desktop VTGDB.COM:1 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
root     112688 110375  0 14:22 pts/0    00:00:00 grep Xvnc

Step 2: Kill all processes of Xvnc

[root@VTGDB.COM tmp]# kill -9 112273

Step 3: Delete all file .X*-lock

[root@VTGDB.COM tmp]# cd /tmp
[root@VTGDB.COM tmp]# ls -a
 sess_8dmq10bg3vnbdcrcqo9ogpsi55  sess_ngvl5qf7pgv4ill44lbfa0q084  .X11-unix
db2chgpath_db2.log.73213   db2prereqcheck.log.128450  .esd-54323                .ICE-unix               .java_pid63614   orbit-oracle                seahorse-KUSesH                  sess_98ta84ni8cvcp1eo18auf3ccd0  sess_tvabjtkkmseko3t3e3q4c69o54  .X1-lock

[root@VTGDB.COM tmp]# rm -fr .X1-lock
[root@VTGDB.COM tmp]# cd .X11-unix/
[root@VTGDB.COM .X11-unix]# ls
X1
[root@VTGDB.COM .X11-unix]# rm -fr *
[root@VTGDB.COM .X11-unix]#

Thursday, May 26, 2016

How to fix the Account Locked (Timed) Oracle

Step 1: Check status of Account:


select username, account_status,profile from dba_users where username='APPUSER';


Step 2: Create an profile

CREATE PROFILE APP_DEFAULT LIMIT
COMPOSITE_LIMIT UNLIMITED
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION UNLIMITED
CPU_PER_CALL UNLIMITED
LOGICAL_READS_PER_SESSION UNLIMITED
LOGICAL_READS_PER_CALL UNLIMITED
IDLE_TIME UNLIMITED
CONNECT_TIME UNLIMITED
PRIVATE_SGA UNLIMITED
FAILED_LOGIN_ATTEMPTS UNLIMITED
PASSWORD_LIFE_TIME UNLIMITED
PASSWORD_REUSE_TIME UNLIMITED
PASSWORD_REUSE_MAX UNLIMITED
PASSWORD_VERIFY_FUNCTION NULL
PASSWORD_LOCK_TIME UNLIMITED
PASSWORD_GRACE_TIME UNLIMITED;

Step 3: Grant the profile to user 'APPUSER':

ALTER USER appusr PROFILE app_default;

ALTER USER appusr ACCOUNT UNLOCK;

Step 4: Check againt status


select username, account_status,profile from dba_users where username='APPUSER';


USERNAME       ACCOUNT_STATUS
------------------------------ --------------------------------
PROFILE
------------------------------
APPUSER        OPEN
APP_DEFAULT

Thursday, May 19, 2016

Wednesday, May 18, 2016

How to set an expiration date for user' password on Linux

Step 1: Open file /etc/login.defs, change option for PASS_MAX_DAYS, For example:

# Password aging controls:
#
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
#       PASS_MIN_DAYS   Minimum number of days allowed between password changes.
#       PASS_MIN_LEN    Minimum acceptable password length.
#       PASS_WARN_AGE   Number of days warning given before a password expires.
#
PASS_MAX_DAYS   90

Step 2: With exist user, you can change expiration date via command:

[root@VTGDB.COM ~]# chage -M 90 username

Monday, May 9, 2016

Installation Mysql, php, apache

My environment:



OS
Red Hat Enterprise Linux Server release 6.5 (Santiago)
MySQL
Version 5.1.73-community MySQL Community Server (GPL)
PHP
PHP 5.6.10 (cli)
Htdoc Directory
/u01/qlts/public_html
Apache Configuration Directory
/etc/httpd/conf

MySQL installation

Detail you can read it:

Step 1: Download MySQL
You access the internet via address:

Step 2: Extracting downloaded file to your installing directory:
[root@VTGDB.COM mysql]# tar -xvpf MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar 

Step 3: Install MySQL client-server:
[root@VTGDB.COM mysql]# rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm

Step 4: Install the “Header and Libraries” that are part of the MySQL-devel packages.
[root@VTGDB.COM mysql]# rpm -ivh MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm

Step 5: Change password for root
[root@VTGDB.COM mysql]# /usr/bin/mysqladmin -u root password '***********'

Step 6: Edit the MySQL Server configuration file:
[root@VTGDB.COM etc]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
port=3306
user=mysql

#UTF 8 Setting
collation_server=utf8_unicode_ci
character_set_server=utf8
skip-character-set-client-handshake

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/u01/mysql/log/mysqld.log
pid-file=/u01/mysql/mysqld/mysqld.pid
[client]
port=3306

Step 7: Restart MySQL Server
[root@VTGDB.COM etc]# service mysql restart

Shutting down MySQL... [ OK ]

Starting MySQL. [ OK ]


Step 8: Login your new MySQL Server
[root@VTGDB.COM ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 604
Server version: 5.1.73-community MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

Php Installation


Step 1: Download Php
You access the internet via address:

Step 2: Extract downloaded file to your installing directory:
[root@VTGDB.COM setup]# tar -xzvf php-5.6.10.tar.gz

Step 3: Run installation file
[root@VTGDB.COM setup]# cd php-5.6.10
[root@VTGDB.COM php-5.6.10]# ./configure  --with-apxs2=/usr/sbin/apxs  \
                                                                            --with-mysql  --with-pdo-mysql
[root@VTGDB.COM php-5.6.10]#make
[root@VTGDB.COM php-5.6.10]#make install

Step 4: Find and Edit php configuration file
[root@VTGDB.COM php-5.6.10]# cp php.ini-development /usr/local/lib/php.ini
[root@VTGDB.COM php-5.6.10]# vi /usr/local/lib/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Ho_Chi_Minh

Step 5: Prepare application directory
[root@VTGDB.COM php-5.6.10]# chsh -s /bin/bash apache
[root@VTGDB.COM php-5.6.10]# mkdir -p /u01/qlts/public_html
[root@VTGDB.COM php-5.6.10]# chown –R apache:apache /u01/qlts/public_html

Step 6: Find and Edit httpd configuration file:
[root@VTGDB.COM php-5.6.10]# vi /etc/httpd/conf/httpd.conf
Listen 8080
User apache
Group apache
#    Options FollowSymLinks
#    Allow from all
#    AllowOverride None
    Options FollowSymLinks
    AllowOverride All
#AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
    ServerAdmin thonh53@gmail.com
    DocumentRoot /u01/qlts/public_html
    ServerName VTGDB.COM
    ServerAlias VTGDB
    ErrorLog /u01/qlts/log/error.log
#    CustomLog logs/dummy-host.example.com-access_log common


Step 7: Restart Apache server
[root@VTGDB.COM php-5.6.10]# service httpd restart

Step 8: Test php
[root@VTGDB.COM php-5.6.10]# su – apache
[apache@VTGDB.COM ~]# cd /u01/qlts/public_html
[apache@VTGDB.COM public_html]# vi info.php
<?php 
     phpinfo();
?>              
Open your browser access address: http://YOUR_IP_SERVER:8080/info.php


Friday, April 8, 2016

How to fix Error Vietnamese font on Xampp

[Describe]: 









[FIXED]

Step 1: Open Xampp Control Panel, Click Config on MySQL Module
























Step 2: Open my.ini




















Step 3: Uncomment rows following and save file my.ini

collation_server=utf8_unicode_ci
character_set_server=utf8
skip-character-set-client-handshake
character_sets-dir="C:/xampp/mysql/share/charsets"







Step 4: Restart MySQL Server on XAMPP Control Panel
Step 5: Reload the page