Temporary fix suphp 500 error with kloxo

March 30th, 2012 No comments

Due to the php version compatibility issue with php-cgi, the apache does not work with suphp. If you get your php version with 5.2.17-13, here is a temporary fix by downgrading your php version to 5.2.17-1.

# backup php.ini
cd /etc
yes | cp -rf php.ini php.ini.bck
cd /

# downgrade to get old version
rpm -e –nodeps php
rpm -e –nodeps php-cli
rpm -e –nodeps php-common
rpm -e –nodeps php-fpm
yum install php-5.2.17-1

# copy to old version
yes | cp -rf /usr/bin/php /usr/bin/php_pure
yes | cp -rf /usr/bin/php-cgi /usr/bin/php-cgi_pure

# make suphp call old version instead new one
cd /usr/local/lxlabs/kloxo/file/
yes | cp -rf etc_suphp.conf etc_suphp.conf.orig
sed -i ‘s/\/usr\/bin\/php-cgi”/\/usr\/bin\/php-cgi_pure”/’ etc_suphp.conf
cd /etc
sed -i ‘s/\/usr\/bin\/php-cgi”/\/usr\/bin\/php-cgi_pure”/’ suphp.conf

# restore php.ini
yes | cp -rf php.ini.bck php.ini

cd /

# back to upgrade
yum upgrade php*

reboot

Useful Unix or Linux Commands

March 1st, 2012 No comments
  1. How to find the latest file on Unix or Linux (recursive)
    find . -type f -printf "%TY-%Tm-%Td %TT %p\n" | sort -r | head -n 1
  2. Remove files which include specific contant
    find ./ -type f | xargs -n 10 grep -l "STRING" | xargs rm
  3. Count files
    only for normal files:

    ls -lR /path/to/dir | grep '^-' | wc -l

    including hidden files:

    ls -laR /path/to/dir | grep '^-' | wc -l

    including hidden files, soft links, Charactor, Block :

    ls -laR /path/to/dir | grep '^[-lcb]' | wc -l

Add a reminder of Email validation at heading area.

December 28th, 2011 No comments

This hack is to add a reminder message at the heading area when members have not yet got their Email validation done.

1. includes/lib_main.php

Find the following codes:

<blockquote>$sql = 'SELECT u.user_id, u.email, u.user_name, u.user_money, u.pay_points'.

' FROM ' .$GLOBALS['ecs']->table('users'). ' AS u ' .

" WHERE u.user_id = '$id'";</blockquote>

add “u.is_validated” into the select strings.

2. themes/theme name/library/member_info.lbi

Add following code at where you want to show the message.


<!--{if $user_info.is_validated eq 0} -->
<font>You have not yet completed Email validation, please validate your Email in member center.</font>
 <!--{/if} -->

Mailto link launchs outlook express but does not create a new email

March 30th, 2011 No comments
  1. Close Outlook Express. RUN command “msimn /reg” from the Start Menu > Run to register msimn.
  2. Open Outlook Express and to the Tools Menu. Select Options. On the General tab, look down to the Default Messaging Programs. More than likely, to top option will say that “This application is NOT the default Mail handler” Click the button next to it that says “Make Default”. This should trigger an available option in Firefox below if it was not already available.
  3. In Firefox, go to the Tools menu. Select Options. Click on Applications. Under the column, “Content Type” look for the mailto function. In the column Action, select “Use Outlook Express (default)” if it is not already selected. “(default)” must be part of the phrase. Somehow there is code behind this option that will bring up a new e-mail in Outlook that otherwise does not work if Outlook is selected manually.

A command to drop all tables in MySql

December 30th, 2010 No comments

mysql –user=YOUR_USERNAME –password=YOUR_PASSWORD -BNe “show tables” YOUR_DBSCHEMA_NAME | tr ‘\n’ ‘,’ | sed -e ‘s/,$//’ | awk ‘{print “SET FOREIGN_KEY_CHECKS = 0;DROP TABLE IF EXISTS ” $1 “;SET FOREIGN_KEY_CHECKS = 1;”}’ | mysql –user=YOUR_USERNAME –password=YOUR_PASSWORD YOUR_DBSCHEMA_NAME

Howto Temporarily Close Site for Maintenance.

December 9th, 2010 No comments

Add follow code to index.php


if ($_SERVER['REMOTE_ADDR'] != '192.168.1.100')
{
 require 'down.htm';
 die();
 }

The code will redirect visitors from all IPs except for 192.168.1.100 to down.htm page.

Manually Upgrade Magento with tarball

December 9th, 2010 No comments

flush cache

rm -rf var/cache/ var/session/ var/report/

Backup files from public_html/magento directory

tar -zcf filename.tar.gz

Read more…

電腦各種符號英文唸法

November 13th, 2010 No comments
Symbol 符號 Description 說明 Chinese 中文/中式說法
~ Tilde 取代符號/毛毛蟲
! Exclamation point 驚歎號
@ At sign, at At符號/小老鼠
# Number sign 數字符號/井號
Pound sign 英鎊符號
$ Dollar sign 錢符號
% Percent, percent sign 百分比,百分比符號
^ Caret 脫字符號/小三角
& Ampersand And符號
* Asterisk 星號/米字號
( Open parenthesis 左括號
) Close parenthesis 右括號
Dash 破折號
Double dash 雙破折號
_ Underscore 底線
+ Plus, plus sign 加,加號
= Equals 等號
| Vertical bar 垂直線/直線號
\ Backslash 反斜線
{ Open brace 左大括號
} Close brace 右大括號
[ Open bracket 左方括號
] Close bracket 右方括號
: Colon 冒號
; Semicolon 分號
Quote 雙引號
Single quote 單引號
, Comma 逗號
. Period, dot 句號,點
> Greater than 大於
< Less than 小於
? Question mark 問號
/ Slash 斜線
// Double slash 雙斜線
Ellipsis 省略符號/點點點
- Hyphen 連字號



符號表引用自頂客論壇:http://www.dk101.com/Discuz/viewthread.php?tid=116102

Dump the Whole MySql Database and Restore

June 3rd, 2010 1 comment

The following steps are how to dump the whole database of a MySql server and then restore them:

  1. Dump all databases by calling:

    mysqldump -uroot -p –extended-insert –all-databases –add-drop-database –disable-keys –flush-privileges –quick –routines –triggers > all-databases.sql

  2. Stop the MySQL server;
  3. Rename or remove (in case you’ve already backed it up) the MySQL data directory;
  4. Make the appropriate changes in my.cnf;
  5. Re-initialize the database with the following command:

    mysql_install_db

  6. Start the MySQL server;
  7. Get into the ‘mysql‘ console and type:

    SET FOREIGN_KEY_CHECKS=0;
    SOURCE all-databases.sql;
    SET FOREIGN_KEY_CHECKS=1;

  8. Restart the MySQL server.

Command to Force mysql Drop Tables without Foreign Key Checks

May 30th, 2010 No comments