Archive

Archive for the ‘server & system’ Category

Linux Command & shell tips (2)

August 11th, 2011 西坪 No comments

1, locale
默认情况下 Ubuntu 是 utf8 的 locale, 如:

liu@dog:$ locale -a
C
en_AG
en_AU.utf8
... ...
zh_CN.utf8
zh_SG.utf8

但某些情况下程序以GBK的Locale运行,则需要启用 zh_CN.GBK 这样的locale。 此时会报错:

$: export LC_ALL=zh_CN.gbk
warning: setlocale: LC_ALL: cannot change locale (zh_CN.gbk): No such file or directory

解决方法:
1) 修改/var/lib/locales/supported.d/local文件,在文件中添加zh_CN.GBK GBK
2) sudo dpkg-reconfigure locales
然后locale -a:

liuzhr@dog:/data/mq_tcp$ locale -a
C
en_AG
en_AU.utf8
en_BW.utf8
... ...
POSIX
zh_CN.gbk
zh_CN.utf8
zh_SG.utf8

2, 不重启服务清空日志

xxx@dog:/data/logs # echo "" > apache-access_2011101110.log

3, MySQL 没有权限的情况 (系统是Ubuntu 10.04 LTS):

The error message in /var/log/mysql/error.log:

/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110821  9:46:07 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110821  9:46:07  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
110821  9:46:39 [Note] Plugin 'FEDERATED' is disabled.

Fix resolution: Edit /etc/apparmor.d/usr.sbin.mysqld , 将mysql-datadir 加入进去,如:

  /data/mysqldata/ r,
  /data/mysqldata/** rwk,

4, 如果 Ubuntu 不能启动怎么办? 答案是试试 boot-repair (Ubuntu 9.10 or later)。 这个问题与 grub2 有关,参考 Ubuntu 社区的 grub2 文档

5, 使用LVM: 参考 这里 还有 这篇

6, 如何在分区之间复制,还保持文件权限不变?

su root;
find / -xdev -print0 | cpio -pa0V /mnt/temp

参考:How to move your filesystem to a new hard drive

7, 如何压缩Linux分区的大小? 参考:Reducing VMDK Size 其中包括使用Gparted做分区复制。

8, Install Eclipse IDE:
http://colinrrobinson.com/technology/install-eclipse-ubuntu/

9, proxy through ssh tunnel:
ssh -CnfND 8080 your-ssh-server.com

Categories: server & system Tags:

Google Apache modpagespeed 测试

November 9th, 2010 西坪 No comments

昨日尝新测试Google Pagespeed Mod。今天重新测试了一下,服务器为OpenVZ vps/amd64bit/512M。Web服务器为 Apache 2.2.11。机器的性能是比较差的,所有数据仅供参考。

从客户端看速度有不错提升

未启用之前在Google Chrome中打开 本页,页面各部分内容的大小如下图:

a2b

请求速度如下图:

a1b

开启mod_pagespeed以后,页面各部分内容的大小如下图:
a2

css减少约1K,js减少1.5K,图片没有太大变化。总体减少约2K。

请求速度如下图:

a1

页面加载时间变化明显,document加载减少了480ms,css减少了6ms(提升比为25%),图片减少了24ms(提升比为18%),js脚本减少了6ms(提升比为25%),整体加载时间减少了460ms(提升比为21%)。

从服务端看

用ab在本机测试服务器的性能,可能是因为机器资源有限,ab本身要消耗一些资源,而本机测试时传输阶段的性能提升可以不计,故整体提升作用不明显。另外,ab不会去获取外部连接的文件也会错过mod_pagespeed在css/js/jpg方面的许多优化工作。尽管如此,处理速度还是有一些提升。开启前,50%的请求需要609ms,开启后降到599ms;66%的请求需要641ms,开启后降到621ms。所有请求的处理时间的中位数从609ms降到599ms。

启用前数据如下:

blog@feihoo:~$ ab -n 1000 -c 3 blog.feihoo.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
 
Document Path:          /
Document Length:        114025 bytes
 
Concurrency Level:      3
Time taken for tests:   209.315 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      114394000 bytes
HTML transferred:       114025000 bytes
Requests per second:    4.78 [#/sec] (mean)
Time per request:       627.946 [ms] (mean)
Time per request:       209.315 [ms] (mean, across all concurrent requests)
Transfer rate:          533.71 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   484  628 108.2    609    1763
Waiting:      224  288  57.5    284    1035
Total:        485  628 108.2    609    1763
 
Percentage of the requests served within a certain time (ms)
  50%    609
  66%    641
  75%    657
  80%    670
  90%    735
  95%    825
  98%    895
  99%    988
 100%   1763 (longest request)

启用后测试结果如下:

blog@feihoo:~$ ab -n 1000 -c 3 blog.feihoo.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
 
Server Software:        Apache/2.2.11
Document Path:          /
Document Length:        114356 bytes
 
Concurrency Level:      3
Time taken for tests:   209.686 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      114755000 bytes
HTML transferred:       114356000 bytes
Requests per second:    4.77 [#/sec] (mean)
Time per request:       629.057 [ms] (mean)
Time per request:       209.686 [ms] (mean, across all concurrent requests)
Transfer rate:          534.44 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       6
Processing:   511  628 216.0    599    3660
Waiting:      233  294 157.4    277    2984
Total:        511  628 216.0    599    3660
 
Percentage of the requests served within a certain time (ms)
  50%    599
  66%    621
  75%    635
  80%    643
  90%    664
  95%    694
  98%   1075
  99%   1641
 100%   3660 (longest request)
Categories: server & system Tags: ,

虚拟机中Host与Guest文件共享

April 13th, 2010 西坪 1 comment

最近很多工作在Linux下做,但是因为整个公司的环境是Windows,很多事情也经常要在Windows下处理。于是在Windows XP上用VMware搭建了OpenSUSE,同时使用这两种系统。经过这段时间的使用,觉得OpenSUSE的桌面支持确实是做得不错的,似乎比Ubuntu更加方便简单。但是Ubuntu更流行,很多简单的设置问题,网络上随处可见Ubuntu的解决方案,而SUSE的方案却难觅踪影。

例如,我经常使用VMWare的共享文件夹特性来在Host与Guest之间交换数据,共享文件。 但是在OpenSUSE下,却没有找到合适的方法。最终,不得不求助于Samba。 Samba在OpenSUSE上的安装是很方便的,基本上遵照 How To Samba With openSuse 10.3 And Windows XP 的指导,三两步就完成了。 完毕以后,在Windows XP 下映射一个盘符到 \\GUEST_HOSTNAME\users 就完成了。我完全关闭了Guest上的防火墙,有防火墙反而可能招致麻烦。

而在OpenSUSE上访问Windows XP也很简单,基本上遵照 SDB:Access to Windows Shares 的 Manual Procedure 部分,将Windows XP共享目录加入到 /etc/fstab 中:

  1 /dev/sda1            swap                 swap       defaults              0 0
  2 /dev/sda2            /                    ext4       acl,user_xattr        1 1
  3 /dev/sda3            /home                ext4       acl,user_xattr        1 2
  4 proc                 /proc                proc       defaults              0 0
  5 sysfs                /sys                 sysfs      noauto                0 0
  6 debugfs              /sys/kernel/debug    debugfs    noauto                0 0
  7 usbfs                /proc/bus/usb        usbfs      noauto                0 0
  8 devpts               /dev/pts             devpts     mode=0620,gid=5       0 0
  9 //x.x.x.x/work   /mnt/windows    cifs  auto,uid=liuz,gid=users,umask=0002,iocharset=utf8,credentials=/etc/winpasswd 0 0

别忘了保护你的密码文件:

chmod 600 /etc/winpassword

特殊之处,是指定了一个 uid=liuz, 将文件的所有者指定为liuz这个用户,方便增删改等操作。有关 uid,gid,umask等的解释如下: (来源)

uid与gid
uid即user identifer,gid即group identifer。设置所有文件的所有者和群组。gid=64,即权限为所有者可读、写,不能执行,群组用户可读、不能写、执行。
umask
umask即user mask,即用户屏蔽。umask=007,即所有文件的权限中,屏蔽其它使用者的读、写、执行权限。

总结

总结一下我使用的这三种方法:

  • 1) 使用VMware提供的共享文件夹功能。
  • 2) 使用Samba为Windows Host OS 共享Linux Guest OS文件系统。
  • 3) 在Linux Guest OS中mount Host OS (Windows系统)的共享文件夹。
Categories: server & system Tags: , ,

导出Memcached中的全部数据

April 5th, 2010 西坪 4 comments

Update(Mar 18th, 2011) 最近,我们针对数十个Memcached集群(数据从几G到几十G)进行了数据转换工作,虽是不得已而为之,但是整个过程还算顺利。编写导出脚本需注意的是cachedump得到的很多key其实已经过期了,这部分过期的key要通过get()操作,将之从Memcached中清除,使之不再出现在下次的cachedump中。
================================================================

因为特别的原因,需要从Memcached中导出所有的数据。因为Memcached对数据的遍历是明确不支持的,所以必须想歪门邪道的方法。

现在网络上主要有两种思路,一种是通过Memcached提供的stats cachedump命令导出,例如下面这些网址:

以上文章都利用这个命令导出了部分数据。但事实上,cachedump的输出会限制在 2*1024*1024=2M 字节的长度内(Memecahed source: items.c, func: do_item_cachedump),其导出的格式如下所示:

ITEM key990017 [1 b; 1270394155 s]
ITEM key990016 [1 b; 1270394155 s]
ITEM key990015 [1 b; 1270394155 s]
ITEM key990014 [1 b; 1270394155 s]

即使不计算key的长度,每一条数据至少要占掉近三十个字节,2M最多到几万项数据。对于Item数量很大的情况下,这种方法并不能导出全部数据。

下面的地址佐证了这些观点。

第二种思路来自 Twitter infrastructure team 的 Evan Weaverpeeping into memcached , 利用 linux 的 ptrace 系统调用导出memcached进程中数据,分析这些数据得到memcached的所有Key。

但是这种方式有其限制的,一方面,编译Memcached时必须编译入调试信息 (参见link); 另一方面,在分析时对内存消耗太大。我们对一个只使用了64M内存、含有76万左右数据项的Memcached进程进行分析,在完成23万左右数据项时,分析进程占用内存的达到1040M,导致虚拟机内存用满,关闭了该进程。

因为我们现在运行的memcached是不带编译符号的,所以放弃了第二种方式。 第一种方式,则只能考虑怎么将slabs中的数据分批导出来。 Memcached 支持一个可选的 slabs reassign 命令,可以将一个slab内的数据项移动到其他slab。但这个命令必须在编译 memcached 时加入该特性。

最后,还是利用了第一种方法,每一次导出一批数据以后就从memcached中删除这一批数据,直到全部导出为止。 虽然这种办法很土,但是还是能够应付一次性数据迁移。 当然这是不得以而为之,明智的做法还是在一开始就不要将需要持久化的数据持久化到其他服务中,而不是只存放于memcached中。

我的VPS使用经验

March 28th, 2010 西坪 No comments
VPSlink/Tetonic/fsckvps

约一年多前开始使用 vpslink 的 Xen VPS,前不久因为实在是没什么事情做,只放了一个博客,觉得有点不值得,就搬到了 Tektonic 上的 OpenVZ VPS。Tektonic的OpenVZ性能也还可以,但很快就发现网速实在是不行。于是试用了一下fsckvps,速度还不错的,可惜服务不好,尤其是上次事故以后,客服响应很差。另外,发现OpenVZ的虚拟机运行java基本是不可行的,甚至 ant/maven 编译个程序都不行。只能将某些能够修改JVM参数的程序手工做好设置(-Xmx480M)才能运行。

Linode

于是开始试用在中国颇为有名的 linode,我比较穷,选择了最便宜的 Linode 360,$19.95/M。 听 blogkid 的 博文 选择了 Fremont 的机房。输入信用卡,vps 很快开通。但是ssh一上去,感觉上很卡,测试了一下速度,速度才 几 K/S。受不了了,在本地测试了一下,发现blogkid 推荐的两个机房(Fremont, Newark)的速度都不行。倒是 Dellas 机房的速度很快,北京联通1M宽带能到140K左右。

于是发了个ticket给linode,很快就回信了,让我重新登录控制面板。果然,控制面板上有了自动迁移机房的按钮。于是开始迁移,速度很慢。第二天早上起来发现迁移完了。试用了一下,速度确实不错。不过很快又遇到了问题,做一个hive的测试,因为内存太少,数据一大进程一多,实在是受不了啊……

于是退了 Linode,申请退款。

Fsckvps + AWS

最后决定采用Fsckvps+AWS的方案。fsckvps 的价格很便宜,虽然fsckvps最近刚刚出过事情,但是我只有一个博客,数据是每天自动备份的。何况 fsckvps 的网速实在是快(北京联通1M能到180K/S,性价比相当不错,我不到 $10/M(年付)就能拿到 512M (burst 1024M)的内存。 Fsckvps的vps的网速实在是不错,在Google Webmaster Tools中,显示我这个博客的速度faster than %92 of sites:

On average, pages in your site take 1.1 seconds to load (updated on Mar 15, 2010). This is faster than 92% of sites.

但是 fsckvps 的虚拟机是 OpenVZ的,你不能用swap,所以基本上不要指望运行吃内存太猛的程序了,在64位平台上,1024M内存的vps连java –version都跑不了。要在这样的内存比较少的VPS上跑Java,必须对堆内存的大小予以限制,因为默认情况下会根据物理内存去申请一定比例的内存,这很可能超出vps的限制(虽然物理机器的内存可能不小,但是每一个vps内存是有配额的)。

export EC2_JVM_ARGS="-Xms128m -Xmx128m"
export ANT_OPTS="-Xms128m -Xmx256m"
export MAVEN_OPTS="-Xms128m -Xmx256m"

事实上,给Maven和Ant限制这么小的内存,导致它们基本失去作用。大部分Java程序的编译都会因为内存超出限额而编译失败。对于基于OpenVZ的VPS,其内存配额在/proc/user_beancounters中,可以用下面的脚本来计算你能用多少内存

for v in vmguarpages privvmpages; do expr `cat /proc/user_beancounters |grep $v |awk -F' ' '{print $4}'` / 256;done

于是我将其他不需要在线的应用,挪到AWS去跑了。

我最后的方案就变成了 FsckVps + AWS. 一个月算起来也不到12$,而且AWS的服务器组集群都行,想咋搞就咋搞。从Fsckvps上操控AWS,实在是太爽了。

总结:
  • 1) Linode 的网速,以我家(北京网通1M)来看,Dellas 的网速是最快的。 1M 能够保持在120K以上,平均在 140K 左右。 其他三个中心的速度并不快。当然网速的问题,不同的时间,不同的宽带差别可能很大。Linode的服务相当不错,控制面板相当智能化,退款也爽快
  • 2)fsckvps 性价比最高,网速最快(在Atlanta机房,达到140~180K/S,相当稳定)。
  • 3)最终的策略是 fsckvps + AWS, 没有多少在线应用的穷人的选择。
Categories: server & system Tags: , , ,

Cygwin下使用公钥登录SSH

December 2nd, 2009 西坪 No comments

为了直接使用公钥登录SSH,而不使用密码登录Cygwin,费了老大劲,很长时间以来一直没有成功。此前,一直是按照网络上流传的方法,主要是生成key,然后设置到 authorized_keys中。遵照官方的命令,修改sshd_config, ssh_config, 但是一直没有奏效(不过遵照这些方法,在Ubuntu等系统上配置成功)。

昨天偶然在这个页面上看到 ssh-user-config 命令,试了试,就成功了!各位设置不成功的同学,考虑使用下这个命令,然后一路回车确认即可。

另一篇重要的参考文章:这里

顺便记录下在探索 SSH使用公钥登录过程中学到的几个sshd相关的命令:

# debug more information 
ssh  -vvv  localhost
 
#start services
net start sshd
#or
cygrunsrv  --start  sshd
 
#login command for user name that has space
ssh  Mickey\  mouse@127.0.0.1
 
#copy publickey to remote host ( 或使用 ssh-copy-id, e.g ssh-copy-id -i ~/.ssh/id_dsa.pub user@host )
king@king:~$ cat .ssh/id_dsa.pub | ssh master "cat - >> ~/.ssh/authorized_keys"
#copy publickey from remote host
king@king:~$  ssh master "cat .ssh/id_dsa.pub" | cat - >> ~/.ssh/authorized_keys"

在某些情况下,必须使用代理登录SSH服务器。connect.c is the simple relaying command to make network connection via SOCKS and https proxy. It is mainly intended to be used as proxy command of OpenSSH. You can make SSH session beyond the firewall with this command.

在Windows下,只需要下载connect.exe到c:/windows,然后在 ~/.ssh/config中添加如下配置:

ProxyCommand connect -S x.x.x.x:x %h %p

connect.c 还支持 https 代理,真不赖。

Categories: server & system Tags:

Weblogic 81Sp3

May 14th, 2009 西坪 No comments

Weblogic 81Sp3 发布时遇到如下错误:

&lt;2009-5-14 下午05时2920秒 CST&gt; &lt;Warning&gt; &lt;Deployer&gt; &lt;BEA-149004&gt; &lt;Failures were detected while initiating Deploy task for application receive.&gt;
&lt;2009-5-14 下午05时2920秒 CST&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;BEA-149201&gt; &lt;Failed to complete the deployment task with ID 0 for the application receive.
weblogic.management.ApplicationException:
Exception:weblogic.management.ApplicationException: prepare failed for receive
Module: receive Error: Could not load receive: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2398)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2310)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:866)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:594)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:508)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
--------------- nested within: ------------------
weblogic.management.ManagementException:  - with nested exception:
[weblogic.management.ApplicationException:
Exception:weblogic.management.ApplicationException: prepare failed for receive
Module: receive Error: Could not load receive: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
]
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2327)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:866)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:594)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:508)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

错误原因是Spring 2.5.5 与Weblogic 81之间不兼容造成的。
详细看这里

Doc: Deployment error on Weblogic 8.1 SP1/SP2 due to manifest issues – upgrade to SP6 required

Categories: server & system Tags:

在 Vista 上安装 Apache 2.2, PHP 5.2.6

October 12th, 2008 西坪 No comments

今天,在Vista上安装了 Apache 2.2, PHP 5.2.6,花费了三四个小时。 Apache 和 PHP 的新版本,在相互兼容性方面似乎是越来越差了!

Apache 2.2  下载完后安装,倒是很顺利,最后 http://localhost, 显示 It works.

一开始,打算以 Module 形式安装 PHP,安装后显示 缺少不少库,并且不能显示 phpinfo.php。

于是改成以 CGI 形式重新安装,配置如下:
ScriptAlias /php/ "D:/software/PHP/"
AddType application/x-httpd-php .php
# For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"

打开网址,什么也访问不了:
You don’t have permission to access / on this server.
通过如下设置解决:
DocumentRoot “D:/programdata/Apachehtdocs”

Options FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
Satisfy all

然后就一直显示:
You don’t have permission to access /php/php-cgi.exe/phpinfo.php on this server.
在后台 error.log:
[error] [client 127.0.0.1] client denied by server configuration: D:/software/PHP/php-cgi.exe

最后,增加如下设置,解决了问题:

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

解决了问题。但是,后台又出现了一个问题:
[Sun Oct 12 22:36:57 2008] [error] [client 127.0.0.1] PHP Fatal error: require_once() [function.require]: Failed opening required ‘SAM/php_sam.php’ (include_path=’.;C:\\php5\\pear’) in sam_factory on line 1

这个问题的解决,参考 [RESOLVED] PHP Install Problem – SAM Error   我只是简单地安装PHP时,只选择 MySQL扩展。

Categories: server & system Tags:

Ubuntu 上安装buildix,PHP5, Apache2

October 12th, 2008 西坪 No comments

一开始,我在计算机上安装了buildix,发现 Buildix的各项功能也能正确运行。但是,一旦我安装并启用了 php5和mod-php5,就会导致buildix被卸载。如下:

liuzhr@suowan-master:/etc/apache2/sites-enabled$ sudo apt-get install php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5 is already the newest version.
The following packages were automatically installed and are no longer required:
python-libxslt1 libapache2-svn libapache2-mod-python sun-java5-jdk python-libxml2 python-svn libapache2-mod-fastcgi cruisecontrol sun-java5-demo
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apache2-mpm-prefork
The following packages will be REMOVED:
apache2-mpm-worker buildix
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5
0 upgraded, 2 newly installed, 2 to remove and 60 not upgraded.
Need to get 0B/2978kB of archives.
After unpacking 5747kB of additional disk space will be used.
Do you want to continue [Y/n]?

如果选择继续,安装了php5和libapache2-mod-php5,则会导致buildix卸载,如果重新安装 buildix,安装过程中会出现下面的错误,原因大概是libapache-mod-php5被buildix自动卸载了。

liuzhr@suowan-master:/etc/apache2/sites-enabled$ sudo /etc/init.d/apache2 restart
* Restarting web server apache2
* We failed to correctly shutdown apache, so we're now killing all running apache processes. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
apache2: Syntax error on line 183 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory。

原因应该是 buildix 依赖于  apache2-mpm-worker, 而目前的 php5只能运行单线程的apache2,这样就必须使用  apache2-mpm-prefork。
使用  apt-cache show buildix 一看,果然buildix依赖于 apache2-mpm-worker。看来必须放弃将 buildix与目前的 php5(Module方式) 在一起安装的方法。

于是只能选择使用 cgi 的方式来安装。参考这篇文章:Installing Apache2 and PHP5 using mod_fcgid 。配置的过程中发生了一些错误(you don’t have permission to access ‘/index.php’),似乎是因为下面的配置中,AllowOverride ,FCGIWrapper ,AddHandler 或者 Options +ExecCGI 的顺序导致的。没有时间仔细研究这个问题,高手看到请指教。

<directory>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
FCGIWrapper /usr/lib/cgi-bin/php5 .php
AddHandler fcgid-script .php
Options +ExecCGI
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</directory>

php5 目前不能使用 apache2-mpm-worker 模块是因为不支持多线程的apache2。 PHP如此说:Why shouldn’t I use Apache2 with a threaded MPM in a production environment? 

有关 apt-get 的命令,参考这里:https://help.ubuntu.com/community/AptGet/Howto

有关 Ubuntu上的LAMP,参考:ApacheMySQLPHP

Categories: server & system Tags: , ,