Archive for January, 2009
CMake 使用方法
今天做实验的时候,用Cmake,它需要搜索一些库。因为语法不通,所以导致一些库找不到,先进行一下扫盲吧,呵呵
用set (PHPTHRIFT_ROOT /opt/thrift/php/src)就找到了。
以下内容来自网络:
CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)。他能够输出各种各样的makefile或者project文件,能测试编译器所支持的C 特性,类似UNIX下的automake。 Read the rest of this entry »
mysqlbinlog的日志
mysql的一些事件都以binary的格式存贮,通过mysqlbinlog这个工具来实现的。
mysqlbinlog可以用于Replication和数据库的恢复
这里主要是说一下mysqlbinlog日志的清理
mysqlbinlog日志的清除
mysql -uroot
PURGE {MASTER | BINARY} LOGS TO ‘log_name’
PURGE {MASTER | BINARY} LOGS BEFORE ‘date’
用于删除列于在指定的日志或日期之前的日志索引中的所有二进制日志。这些日志也会从记录在日志索引文件中的清单中被删除,这样被给定的日志成为第一个。
eg:
PURGE MASTER LOGS TO ‘mysql-bin.030′;
PURGE MASTER LOGS BEFORE ’2009-01-10 11:00:00′; Read the rest of this entry »
Sendmail的域名和子域名问题
以前就没搞过sendmail,开始配过qmail,后来一直用Postfix。
今天www服务器那边用sendmail发不出邮件去了,而发到其他的邮箱没问题,
因为主机是www.xxx.com 而邮件服务器又在别的上面。mail.xxx.com
所以sendmail一发到xxx.com就报错。
Jan 16 10:34:18 web sendmail[19020]: n0G2YIwd019018: SYSERR(root): mail.xxx.co
m. config error: mail loops back to me (MX problem?)
Jan 16 10:34:18 web sendmail[19020]: n0G2YIwd019018: to=<help@xxx.com>, ctladd
r=<daemon@www.xxx.com> (2/2), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, p
ri=121387, relay=mail.xxx.com. [222.173.95.50], dsn=5.3.5, stat=Local configur
ation error
Jan 16 10:34:18 web sendmail[19020]: n0G2YIwd019018: n0G2YIwd019020: DSN: Local
configuration error
到官方FAQ,看也不是它说的那种问题。自己添加一个DNS服务器问题依旧。
试着改一下sendmail的配置文件看看, /etc/mail/sendmail.cf
改后正常。
# my official domain name
# … define this only if sendmail cannot automatically determine your domain
Dj$w.xxx.cn
估计你也能看明白了吧,就是不让sendmail自动获取域名,你自己指定一个。防止和xxx.com冲突。
php curl参数
Posted by in LAMP on 2009-01-16
<?php
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $_GET['q']);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$handles = curl_exec($ch);
curl_close($ch);
echo $handles;
?>
注: curl函数参考 Read the rest of this entry »
mysql数据表损坏修复方法(来自网络)
当你试图修复一个被破坏的表的问题时,有三种修复类型。如果你得到一个错误信息指出一个临时文件不能建立,删除信息所指出的文件并再试一次–这通常是上一次修复操作遗留下来的。
这三种修复方法如下所示:
% myisamchk –recover –quick /path/to/tblName
% myisamchk –recover /path/to/tblName
% myisamchk –safe-recover /path/to/tblName Read the rest of this entry »
关于crontab的一点补充
使用crontab定时执行,如果网上搜索每N分钟执行一次,估计会搜到很多 */N * * * *
今天在做东西的时候才发现这是不对的,只有在 N <= 30 的情况下才能成立
* 代表 0-59
而当 */N 是整除是才能执行,比如N=45 那么只有在 1:00 1:45 2:00 2:45执行
因为只有0,45才能整除
因此如果要每45分钟执行一次,需要计算。
0 */3 * * * root /srv/urscript
45 */3 * * * root /srv/urscript
30 1,4,7,10,13,16,19,22 * * * root /srv/urscript
15 2,5,8,11,14,17,20,23 * * * root /srv/urscript
优化Apache
硬件上的优化就不用说,花银子买了。呵呵
软件上的说一下吧
系统级别上:
1. 关掉不需要的服务,一方面是安全,还就是优化了。
2. 保持软件更新,也是安全和优化方面的事。
vi /etc/sysctl.conf
# Use TCP syncookies when needed
net.ipv4.tcp_syncookies = 1
# Enable TCP window scaling
net.ipv4.tcp_window_scaling = 1
# Increase TCP max buffer size
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# Increase Linux autotuning TCP buffer limits
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
# Increase number of ports available
net.ipv4.ip_local_port_range = 1024 65000 Read the rest of this entry »