vBulletin upgrade (4.01)

ผม upgrade vBulltein จากเวอร์ชัน 3.5.X เป็น เวอร์ชัน 4.01  แล้วพบว่าเกิดข้อความ error ดังข้างล่าง

PHP Fatal error:  Call to a member function hide_errors() on a non-object in /home/www/vhosts/xxxx.com/httpdocs/forums/includes/class_bootstrap.php(283) : eval()'d code on line 4

ปัญหาเกิดจากตัว plugin ที่ใช้ในเวอร์ชัน 3.5.X วิธีการแก้ปัญหาคือ ให้แก้ไขไฟล์ config.php โดยใช้คำสั่ง

define('DISABLE_HOOKS', true);

เพื่อยกเลิกการใช้งานทั้งหมดก่อน 😉

ลืม password ของ root!

วิธีการเปลี่ยน password ให้ทำตามนี้

4.4 Losing Your Root Password
If for some reason you lose your root password you can change it by following these steps:

1) Reboot your machine.

2) From GNOME, log out, and choose the reboot option. Or from the login screen, click ‘System’ then ‘Reboot’. From console mode, press Ctrl-Atl-Del (which in Linux reboots the system in a controlled fashion). You will see the shutdown sequence begin.

3) Allow the system to reboot to the GRUB splash screen, and then press “e”. Select the line containing “kernel”, and press “e” again. GRUB will display the line in edit mode.

4) Add “single” to the end of the line, and press return. GRUB will return you to the previous screen.

5) Press “b” to boot the system into what will now be single user mode. The system will come part of the way up, and then drop you into a root shell – the prompt will look like this: sh-2.05# _

6) Type “passwd” and press return. The system will ask you for a new password. Type in your new password, then to retype it as confirmation (it will not display on the screen). If the two entries do not match, it will ask you to try again. It will also warn you if it thinks the password is too obvious; you can ignore the warning, but if you are on a computer that either isn’t behind a firewall or is in a public area, this is not recommended.

7) Once the new password is in place, type “exit” and press return to allow the system to finish booting. Passwords should be something you can remember without writing down, but not something anyone else could figure out. Dictionary words and passwords that are all numbers are not recommended. Subtle misspellings, funny capitalizations (Linux is case sensitive), and substituting numbers or special characters for letters make good passwords. For instance, the first letters of the words in a phrase can work, too. Some good examples are:

BaceBawl
fOOdfiGHt
p@ssw3rd

With the new MD5 password security, passwords are no longer limited to eight characters as in older versions of UNIX. The limit is on your own memory, typing accuracy, and patience.
Important: Please remember to change the default root password as soon as you become acqainted with your system.

ที่มา: #151525

Identifying iPhone browser

PHP:

  $iphone = strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone');
  $ipod = strpos($_SERVER['HTTP_USER_AGENT'], 'iPod');
  if($iphone || $ipod){
    header('Location: http://m.example.com/');
  }

JavaScript:

if((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1)){
  document.location = "http://m.example.com/";
}

ที่มา: http://eugen.io/2009/12/setting-up-your-web-site-to-run-on-iphone-browser/

PHP Catchable fatal error, WP_Error – wpmu-functions.php

ผมติดตั้ง WordPress MU  2.8.1 แล้วใช้งานไปสักพัก  พบว่าเมื่อคลิกที่ Site Admin -> Options แล้วการแสดงผลมาหยุดที่คำว่า Dashboard Blog พร้อมๆ กับมี error message ข้างล่างโผล่ใน log  (ผมลองติดตั้งใหม่อีกรอบ ก็ยังคงเจอปัญหานี้เหมือนเดิม)

[error]  PHP Catchable fatal error:  Object of class WP_Error could not be converted to string in /home/…path…/wp-includes/wpmu-functions.php on line 107, referer: http://…website…/wp-admin/wpmu-themes.php?updated=true&action=themes

เมื่อลอง search แล้วก็พบวิธีการแก้ปัญหาที่นี่

Hi, I’ve seen the error and here is my solution (I promise it will work for you guys, too)

Go to your phpmyadmin. Select the name of the database which your wordpress mu is using. Go to Search.

At the: Word(s) or value(s) to search for (wildcard: “%”) type: dashboard_blog

Then on the Inside table(s): you have to scroll down and select wp_sitemeta to be inserted in the Search. OK, just click Go.

You will have the search resources above like this:

Search results for “dashboard_blog” at least one of the words:
2 match(es) inside table wp_sitemeta | Browse | Delete

Click Browse and you will see 2 table. Edit the table name dashboard_blog.

Whatever you see the meta_value is. I don’t remember exactly (may be ERROR and something) but you don’t need to worry. Just delete all and type 1. Yes, just type the word “1” in the box ONLY.

Finally, click Go. And log in to you WP. See the result.

It works for me and I hope that it works for you, too.

Have a nice day!

ขอคัดลอกมาเก็บไว้เพราะคิดว่า คงได้แก้ปัญหาแบบนี้บ่อย :p

วิธีการลบ mailman archives

เมื่อต้องการลบ archives ของ mailing list (mailman) ให้ทำดังนี้

cat /dev/null > archives/private/listname.mbox/listname.mbox
bin/arch --wipe listname

ควรทำการ backup listname.mbox ไว้ป้องกันความผิดพลาดด้วยครับ 😉