wordpress首页只显示某个分类的文章/rewrite实现

wordpress首页只显示指定的某个分类的文章,一个比较怪的需求,网上好像很少人有这样的需求。

这个需求是这样的,您目前正常访问的这个wordpress站点http://www.path8.net, 是一个部分原创,较多的转载的技术站点;其中原创文章主要在一个分类中。原创的东西当然更希望更多多阅读,也方便跟更多人分享知识交流经验。于是设想在首页显示原创文章,这样就能实在上述目标。

但网上查找相关的资料。有人说修改程序原代码,非常不赞成这种方法,修改源码,就失去了以后升级的便捷性。

突然想到,可能使用rewrite实现,就是把“对wordpress根目录直接的访问”重写到某个指定的分类上。

于是参考wordpress的.htaccess再补习一下rewrite规则,花了两个晚上,尝试了多次,终于实现了。

.htaccess如下(其实只加了标红的那一行,22是想在首页显示的分类编号):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /tn/
RewriteRule ^$ /tn/index.php?cat=22 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /tn/index.php [L]
</IfModule>
# END WordPress

不过,因为本站的wordpress不是在网站目录下安装,而是在/tn目录里,所以规则可能跟你的站点不一样。如果你的wprdpress在站点根目录下安装,则把其中/tn删除应该就可以了,我没有试。

存在问题:这个方法有一个比较重大的问题,就是分页,首页显示某个分类的文章,但下面的分页,则是全站文章的分页。

如谁有更好的实现方案,请分享交流。

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

其实通过以下插件实现这样功能:Front Page Category, Front Page Excluded Categories, 但效果好像并不好,如有一篇文章同属两个分类,正好这两个分类一个是允许显示在首页,另一个不允许显示在首页上的,这样情况下,这篇文章就不能显示于首页。如有篇文章属于cat=22,同时又属于cat=28, 而只有22这个分类是允许显示的,这种情况下,我需要让它显示出来,但事实上,这两个插件都不会显示这篇文章的。

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

2010-09-26补记

“wordpress首页只显示某个分类的文章” 该功能已经实现,在探索该功能的过程中,先后用了两个方案,这里是第一个rewrite方案,正如如上面“存在问题”说的,下面是一个以wordpress插件完美实现的解决方案,

wordpress首页只显示某个分类的文章/插件实现(完美实现,附插件源码)<推荐>

推荐使用这个插件方案。该插件是一个wordpress插件 Front Page Excluded Categories基本上稍做修改而成,在此感谢前人的工作。

linux(fedora13)下google chrome 安装后无法启动Failed to move to new PID namespace: Operation not permitted

系统环境:fedora13, linux 2.6.31.5-127.fc12.i686.PAE, gnome

核心操作:关闭selinux

以前使用fedora12及更早的fedora版本,安装chrome都非常正常,安装后,就可以正常启动运行。但这次,突然出问题了,从系统菜单里启动,老半天没有一点反应,查看进程,有chrome进程,看来是有错误了。于是杀死进程,命令行启动,看看究竟是什么错误消息。

/usr/bin/google-chrome: /lib/libz.so.1: no version information available (required by /usr/bin/google-chrome)
/usr/bin/google-chrome: /lib/libz.so.1: no version information available (required by /usr/bin/google-chrome)
Failed to move to new PID namespace: Operation not permitted

习惯性的拿错误消息问google,结果全是英文页面,看了两个,好像也没有说出来最终的解决方法。那就是自己捣腾一下,说不定就解决了。

上面两行错误消息,看不出来名堂,但下面的条里 not permitted,没权限,怀疑是否是不是selinux的原因,但没有看到selinux消息报告,所以之前没有想到这里,印象中sellinux是启动的,fedora13安装后,selinux就是启动的,经常会造成一点问题,由于对selinux并不熟悉,出问题时只好关掉。扯远了——不管是不是,关掉看看。

setenforce 0

再从命令行里启动,好了,chrome还给一个对话框,大意说启动失败了,是不是要报告错误,选择跳过,然后是就正常的询问是否从其它浏览器里导入设置,因为firefox正在启动中,无法完成导入,也跳过。接下来就是跟平时无两样的chrome。

从命令行终端里拷出来从安装到问题解决的整个过程的消息,稍做删减,帖在下面,以备查阅。

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

[feng@fsc ~]$ su
密码:
[root@fsc feng]# touch /etc/default/google-chrome
[root@fsc feng]# pwd
/home/feng
[root@fsc feng]# cd downloads/
[root@fsc downloads]# ll
总用量 293296
.......
-rw-rw-r--. 1 feng feng 27101501  9月 24 22:24 google-chrome-stable_current_i386.rpm
.......
[root@fsc downloads]# ll
总用量 293296
.......
-rwxr-xr-x. 1 feng feng 27101501  9月 24 22:24 google-chrome-stable_current_i386.rpm
.......
[root@fsc downloads]# rpm -ivh google-chrome-stable_current_i386.rpm
warning: google-chrome-stable_current_i386.rpm: Header V3 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
lsb >= 3.2 is needed by google-chrome-stable-6.0.472.63-59945.i386
[root@fsc downloads]# yum install lsb
已加载插件:presto, refresh-packagekit
设置安装进程
解决依赖关系
--> 执行事务检查
---> 软件包 redhat-lsb.i686 0:4.0-5.fc13 将被 安装
updates/filelists_db                                     | 6.8 MB     00:32
--> 处理依赖关系 /usr/bin/pax,它被软件包 redhat-lsb-4.0-5.fc13.i686 需要
--> 执行事务检查
---> 软件包 pax.i686 0:3.4-10.fc12 将被 安装
--> 完成依赖关系计算

依赖关系解决

================================================================================
软件包              架构          版本                  仓库              大小
================================================================================
正在安装:
redhat-lsb          i686          4.0-5.fc13            updates           25 k
为依赖而安装:
pax                 i686          3.4-10.fc12           fedora            67 k

事务概要
================================================================================
Install       2 Package(s)

总下载量:92 k
Installed size: 156 k
确定吗?[y/N]:y
下载软件包:
Setting up and reading Presto delta metadata
updates/prestodelta                                      | 332 kB     00:01
Processing delta metadata
Package(s) data still to download: 92 k
(1/2): pax-3.4-10.fc12.i686.rpm                          |  67 kB     00:00
(2/2): redhat-lsb-4.0-5.fc13.i686.rpm                    |  25 kB     00:00
--------------------------------------------------------------------------------
总计                                            123 kB/s |  92 kB     00:00
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在安装       : pax-3.4-10.fc12.i686                                     1/2
正在安装       : redhat-lsb-4.0-5.fc13.i686                               2/2

已安装:
redhat-lsb.i686 0:4.0-5.fc13

作为依赖被安装:
pax.i686 0:3.4-10.fc12

完毕!
[root@fsc downloads]# rpm -ivh google-chrome-stable_current_i386.rpm
warning: google-chrome-stable_current_i386.rpm: Header V3 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
Preparing...                ########################################### [100%]
1:google-chrome-stable   ########################################### [100%]
job 1 at Fri Sep 24 22:34:00 2010
[root@fsc downloads]# ps aux |grep chrome
feng     11721  0.0  0.3  67368  9068 ?        S    22:33   0:00 /opt/google/chrome/google-chrome
feng     11724  0.0  0.0  67636  2540 ?        S    22:33   0:00 /opt/google/chrome/google-chrome
root     11725  0.0  0.0      0     0 ?        Z    22:33   0:00 [chrome-sandbox] <defunct>
root     11769  0.0  0.0   4316   736 pts/0    R+   22:34   0:00 grep chrome
[root@fsc downloads]# exit
exit
[feng@fsc ~]$ chrome
bash: chrome: command not found
[feng@fsc ~]$ google-chrome
/usr/bin/google-chrome: /lib/libz.so.1: no version information available (required by /usr/bin/google-chrome)
/usr/bin/google-chrome: /lib/libz.so.1: no version information available (required by /usr/bin/google-chrome)
Failed to move to new PID namespace: Operation not permitted

^C
[feng@fsc ~]$ lsb >= 3.2 is needed by google-chrome-stable-6.0.472.63-59945.i386
[feng@fsc ~]$ su
密码:
[root@fsc feng]# setenforce
usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@fsc feng]# setenforce 0
[root@fsc feng]# setenforce 0
[root@fsc feng]# exit
exit
[feng@fsc ~]$ google-chrome
/usr/bin/google-chrome: /lib/libz.so.1: no version information available (required by /usr/bin/google-chrome)
/usr/bin/google-chrome: /lib/libz.so.1: no version information available (required by /usr/bin/google-chrome)
/opt/google/chrome/chrome: /lib/libz.so.1: no version information available (required by /opt/google/chrome/chrome)
/opt/google/chrome/chrome: /lib/libz.so.1: no version information available (required by /opt/google/chrome/chrome)
[11975:11975:33768698664:ERROR:chrome/common/json_pref_store.cc(44)] Error reading Preferences: File doesn't exist. /home/feng/.config/google-chrome/Local State: 没有那个文件或目录
[11975:11975:33768781502:ERROR:chrome/common/json_pref_store.cc(44)] Error reading Preferences: File doesn't exist. /home/feng/.config/google-chrome/Default/Preferences: 没有那个文件或目录
/proc/self/exe: /lib/libz.so.1: no version information available (required by /proc/self/exe)
/proc/self/exe: /lib/libz.so.1: no version information available (required by /proc/self/exe)
^Z
[2]+  Stopped                 google-chrome
[feng@fsc ~]$ bg 2
[2]+ google-chrome &
[feng@fsc ~]$

asp vbscript报错“字符串空间不够”

asp vbscript报错"字符串空间不够"

写一个新产品的rss,把所有xml拼接到一个字符串里,然后一并response.write输出,但在服务器上运行时,出错了,asp/vbscript报错"字符串空间不够",出错的行,也确实是拼接字符串的行。

字符串还会空间不够,只有几百条产品的rss,感觉最大也只不过几十K的样子。怀疑是否是程序有错,但这样简单的程序,应该不会写错的,google一下,好像没有看到有用的东西,有两篇也是没有解决的“死”问题。看来还得自己解决。

根据错误提示,像是说字符串长度问题,也是是超出了vbs字符串允许的最大长度,印像中vbs不该这样超过长度——不是科班出身,没有系统的学过vbscript,不知道vbs的字符串是否有长度限制——

那就姑且当它是超过了允许最大长度,修改一下:既然是超过最大长度,那就让它分批输出,加上如下面代码中标红代码。

上传运行,正常,问题解决。

看来真的vbscript真的有字符串最大长度限制。

i=1
do while not rs.eof
if i mod 30=0 then
response.Write(str)
str=""
end if

str = str + "<item id="""&i&"""><title><![CDATA["&rs("title")&"]]></title>"& vbcrlf
str = str + "<link>"&linkurl&rs("id")&"</link>"& vbcrlf
str = str + "<description><![CDATA["&rs("title")&"<br>Number:"&rs("number")&"<br>"&left(rs("intro"),500)&"]]></description>"& vbcrlf
str = str + "<pubDate>"&rs("date")&"</pubDate>"& vbcrlf
str = str + "</item>"& vbcrlf
rs.movenext
i=i+1
loop
rs.close

php的文档里有这样一段话:

"注: 一个字符串变得非常巨大也没有问题,PHP 没有给字符串的大小强加实现范围,所以完全没有理由担心长字符串。"

但vbscript没有见过这样的说法,也可能是记串了。

IE9 preview试用,很垃圾,很失望

或许毕竟还只是preview版本的原因,也或许是IE实在垃圾的原因,试用了一个ie9 preview4版本,当然是m$官方下载了,google搜索ie9,第一条就是,下载,用上网本的windows7下的firefox下载,速度不快,开始50K,半分钟就隆到10K以下了,于是在frdora下使用jigsaw下载,速度平均在40K左右的样子,2M的带宽,下载只有这么40K,可能是ms他们的下载服务器没搞好,或者考虑到只是下预览版,没有考虑大量下载负荷的问题。拷到上网本的win7下,安装,照例是傻瓜安装,也照例是安装微软程序习惯的“重启”电电脑。重启吧,是多系统,win7只是其中一个,不是默认进入,还要选择。启动过程中,又出现“windows update正在配置”的提示,还要下载3个更新包,应该并不大,几分钟完成了,进入windows画面。桌面上多出来傻傻的IE图标,点击进去,果然跟网上别人发的图片一样,没有地址栏,要从菜单里打开一个输入地址的小对话框。菜单也简陋得不成样子,但里面第二个菜单项就是debug,看来微软意识到他自己浏览器的问题了,要附带上一下调试工具,不然,鬼才能搞懂那变态的、诡异的css支持。没有仔细看是否调试里有IE5,7,8几个版本的兼容选项,就是没有IE6。打开google首页随便搜索个关键词,机器猫css,想看看IE9preview对css的支持如何,是否真的如网上的篇文章里说的、连google都有称赞它的地方。然而结果列表链接去好像无法打开,试几次都不知,于是直接关掉,然后卸载ie9,实在比较垃圾,这个ie9.虽然maxthon等浏览器也基于ie的内核,但加入了很多实用的功能,可ie,却像头老病牛一样,一点一点的挪动着,缓缓的,比散步都慢,堪称牛步。

fedora 12,13,14,15,16/centOS/redhat EL 使用第三方yum 源rpmfusion.org

以下内容来源于rpmfusion.org官方网站的使用说明

通过命令行注册并启用rpmfusion.org yum 源/Command Line Setup using rpm

To enable access to both the free and the nonfree repository use the following command:

  • Fedora 12 and 13 and 14 and 15:
    su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'
  • Fedora Rawhide and what will become Fedora 16 (Alpha, Beta and snapshots):
    su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-rawhide.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-rawhide.noarch.rpm'
  • RHEL5 or compatible like CentOS:
    su -c 'rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/5/i386/rpmfusion-free-release-5-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/5/i386/rpmfusion-nonfree-release-5-0.1.noarch.rpm'

官方网站的说明上好像还有使用浏览器安装rpm源的,没有试过,还是习惯使用命令行操作,毕竟命令行才是根本。

http://rpmfusion.org/Configuration

rpmfusion.org yum 源简介

RPM Fusion 是为 Fedora 及 Red Hat Enterprise Linux 用户提供的一个软件包仓库。各位 Fedora/RHEL /centOS朋友要是想要安装的软件在官方的仓库中找不到,不要泄气,兴许通过 RPM Fusion 你就找到了。

新启动的 RPM Fusion 合并了原有的 Dribble、Freshrpms、Livna 等软件包仓库,将成为最大的第三方软件包仓库。

通过 RPM Fusion 软件包仓库,你将找到 ATI/NVIDIA 显卡驱动、私有的音频/视频编码/解码器、游戏、模拟器、以及其他软件包等。

wine个人目录下菜单项Programs位置/wine菜单项腾讯软件QQ2010删除卸载

fodora13,gnome桌面,只因为无聊测试之用,运行QQ2010的安装程序,安装向导基本正常运行运行,但无法正常使用,所以卸载,但运行卸载后,主菜单里还有wine菜单项,里有Programs子菜单,里面还有“腾讯软件-QQ2010”,再运行里里面的卸载,还是一样,这个菜单项并不能自动删除。

于是自己找一样,这个菜单项具体在哪个目录里的哪个文件。

新建一个账号,登录后,主菜单里没有wine一项,所以基本上可以认定,这个菜单项在用户目录里。

锁定在用户家目录里找,这种配置型的文件一般都会在隐藏目录里,那就在家目录里运行 ls -a , 里面有.local目录,终于在这个目录里找了这个菜单项

.local/share/applications/wine/Programs

下面要做的就很简单了,不必多说。

Linux 下用户home目录下文件夹名字修改Desktop,Documents,Downloads,Pictures等

核心:vi ~/.config/user-dirs.dirs 编辑这个文件,文件格式很简单,一看就明白了

使用fedora linux,用户home家目录下缺省情况下可能会有以下几个目录,

Desktop    Downloads  Music  Pictures    Videos  Documents  Maps    Public    Templates

使用图形界面时,如需要选中一下文件夹,习惯上打该文件夹名字的第一个字母(如有多个同首字母目录时,再打第二个字母),这样可以很方便的快速定位,多数文件管理器都有这样功能,使用非常方便,但home目录下的几个缺省文件夹名字是大写开头的,小写输入法下打第一个字母,并不能定位;linux对文件名的大小写敏感。按shift+相应的字母,总是不方便,要同时按下shif键。

于是想,是否可以把这几个文件夹的名字改一下,首字母改成小写,这样就会方便得多。当然,直接把文件夹名字改掉,大写开头的文件夹还会被创建,也就是说,默认情况下,linux(其实应该是gnome的文件管理程序)并不认可小写的文件名。linux是可以无限定制的,家目录下文件名这一点,一定也会在某个地方有配置文件,而且应该是点号(.)开头的隐藏文件。但具体位置并不知道,没有到网上搜索相关资料,想根据自己猜测分析找到它;这样可以锻炼加深对linux的理解,也比较有成就感。

分析:这样的配置文件,应该是分别在每个用户的家目录下,这样方便每个用户自己定义这些文件名。因为在修改默认语言时(如从中文修改为英文,或相反),linux会询问是否更新家目录下的这些目录名。

于是查看家目录下的隐藏文件,

[feng@fsc ~]$ ls -al
总用量 86844
drwx------. 67 feng feng     4096  9月  5 15:00 .
drwxr-xr-x.  4 root root     4096  8月  4 01:30 ..
drwx------.  3 feng feng     4096  8月  6 23:34 .adobe
drwx------.  8 feng feng     4096  8月 28 23:10 .amsn
drwx------.  2 feng feng     4096  8月 21 21:13 amsn_received
drwxrwxr-x.  4 feng feng     4096  8月 22 00:42 .audacity-data
-rw-------.  1 feng feng     2074  9月  5 01:22 .bash_history
-rw-r--r--.  1 feng feng       18  3月 31 20:14 .bash_logout
-rw-r--r--.  1 feng feng      176  3月 31 20:14 .bash_profile
-rw-r--r--.  1 feng feng      124  3月 31 20:14 .bashrc
drwx------.  7 feng feng     4096  9月  5 14:53 .beagle
drwxrwxr-x.  2 feng feng     4096  8月 21 22:53 .BloGTK
-rw-rw-r--.  1 feng feng     4096  8月 23 22:37 brasero-session.log
drwx------.  8 feng feng     4096  8月 29 14:24 .cache
drwxrwxr-x.  3 feng feng     4096  8月  5 22:13 .color
drwxr-xr-x. 22 feng feng     4096  9月  5 14:55 .config
drwx------.  3 feng feng     4096  8月  4 01:31 .dbus
drwxrwx---.  3 feng feng     4096  8月 22 00:42 .denemo
drwxr-xr-x.  2 feng feng     4096  9月  5 15:00 Desktop
......................
-rw-r--r--.  1 feng feng      188  8月 29 22:56 .yumex.conf

文件很多,很多软件都有一个相应的隐藏文件,作为当前用户的配置文件。注意到其中有一个下.config目录

drwxr-xr-x. 22 feng feng     4096  9月  5 14:55 .config

很可能在这里,进去看看

[feng@fsc ~]$ cd .config/
[feng@fsc .config]$ ll
总用量 96
drwxrwxr-x. 2 feng feng 4096  8月 29 09:18 akonadi
drwxrwxr-x. 5 feng feng 4096  8月 28 09:11 awn
drwx------. 2 feng feng 4096  8月 23 22:41 brasero
drwx------. 2 feng feng 4096  8月  7 11:31 Empathy
drwx------. 2 feng feng 4096  8月 15 15:08 enchant
drwx------. 5 feng feng 4096  8月 29 11:22 geany
drwx------. 2 feng feng 4096  8月 29 22:53 glista
drwxr-xr-x. 3 feng feng 4096  8月  4 01:31 gnome-disk-utility
drwxr-xr-x. 3 feng feng 4096  8月  4 01:31 gnome-session
drwxrwxr-x. 4 feng feng 4096  8月  4 01:31 gnote
drwxrwxr-x. 2 feng feng 4096  8月 21 22:23 Google
drwx------. 2 feng feng 4096  9月  5 00:02 gtk-2.0
drwx------. 3 feng feng 4096  8月  4 01:31 ibus
drwxrwxr-x. 2 feng feng 4096  8月 29 23:07 InSilmaril
drwxrwxr-x. 3 feng feng 4096  9月  3 23:03 menus
drwxrwxr-x. 2 feng feng 4096  8月 15 15:08 pino
drwxrwxr-x. 4 feng feng 4096  9月  5 12:49 smplayer
drwx------. 2 feng feng 4096  8月 29 00:42 Thunar
drwxr-xr-x. 6 feng feng 4096  8月 29 13:52 transmission
-rw-rw-r--. 1 feng feng 8561  8月 29 23:09 Trolltech.conf
-rw-------. 1 feng feng  632  8月 15 15:44 user-dirs.dirs
drwxrwxr-x. 2 feng feng 4096  8月 22 01:57 zim

注意到其中的 user-dirs.dirs文件,从文件名字是判断,很可能就是它,打开看看

vi user-dirs.dirs

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

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
~
~
~
~
~
~
~
~
"user-dirs.dirs" 15L, 632C                                          12,1         全部

第一行写明:xdg-user-dirs-update创建修改的这个文件,修改一下试试,把下面的大写目录名改成小写的。

然后把home家目录下的几个大写首字母的目录改名,当然改成小写首字母的。

[feng@fsc ~]$ mv Documents/ documents
[feng@fsc ~]$ mv Downloads/ downloads
[feng@fsc ~]$ mv Maps maps
[feng@fsc ~]$ mv Music music
[feng@fsc ~]$ mv Templates/ tempates
[feng@fsc ~]$ mv Videos/ videos
......

然后用firefox下载个东西试试,看默认保存位置是否是到downloads里面了

一次简单的探索,志之于此

fedora/linux升级firefox/fedora13安装新版本firefox

fedora官方的firefox的rpm/yum安装包更新非常慢,远远滞后于firefox的升级步骤。拿目前(2010-08-29)的版本来看,firefox最新版本是3.6.8,但yum上,版本只更新到了3.6.3.

虽然firefox的最近几个子版本号更新并没太大的改动,使用上没有感觉到有什么不同之处,不过对于“新版本升级爱好者”来说,升级到最新版本心里会感觉顺畅一些。

完美的升级firefox,是一件很麻烦的事情。

从firefox官方下载升级包,解压缩到rpm安装位置/usr/lib/firefox-3.6,如果没有启用selinux,可以正常使用(解压缩到其它目录里也是一样可以正常运行,但这样会有两个版本的firefox,有点洁癖~~);但如果selinux运行,会提示错误:libxul.so无权限。因为对selinux并不熟悉,掏腾一下,没有搞定。

于是找rpm包,http://rpm.pbone.net/这里有rpm包,但没有最新的3.6.8的32位包,于是下载3.6.7的,下载安装,有依赖包libvpx,照例这这个网站下载顺利安装,接下来不有依赖包:xulrunner,下载安装,跟firefox两个包互相依赖,错误信息里提到到版本号还不对,比较可恶。加--force参数,两个包一起安装,还是不行。加上参数--nodeps --force得以安装,运行firefox,正常启动,查看版本号,是3.6.7的版本。完成。

突然想到用rpm -q firefox查看一下版本,发现两个版本的rpm包同时存在,

[root@fsc /]# rpm -q firefox
firefox-3.6.3-4.fc13.i686
firefox-3.6.7-1.fc13.i686

发现了,之前的安装发现这里应该用rpm升级进行的安装。于是需要,卸载老的版本,

[root@fsc /]# rpm -ev firefox-3.6.3-4.fc13.i686

xulrunnerb也是同时存在两个版本的,卸载时,有多个依赖包,太麻烦,不卸载了。 Linux博大精深,还要多多学习啊!

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

下面是操作过程中的部分命令记录,作为备忘参考。

[root@fsc /]# rpm -ivh /home/feng/Downloads/libvpx-0.9.1-2.fc13.i686.rpm
Preparing...                ########################################### [100%]
1:libvpx                 ########################################### [100%]
[root@fsc /]# rpm -ivh /home/feng/Downloads/firefox-3.6.7-1.fc13.i686.rpm
error: Failed dependencies:
xulrunner >= 1.9.2.7-1 is needed by firefox-3.6.7-1.fc13.i686
[root@fsc /]# rpm -ivh /home/feng/Downloads/xulrunner-1.9.2.7-2.fc13.i686.rpm
error: Failed dependencies:
xulrunner >= 1.9.2.4 conflicts with firefox-3.6.3-4.fc13.i686
[root@fsc /]# rpm -ivhf /home/feng/Downloads/xulrunner-1.9.2.7-2.fc13.i686.rpm
error: Failed dependencies:
xulrunner >= 1.9.2.4 conflicts with firefox-3.6.3-4.fc13.i686
[root@fsc /]# rpm -ivh --force /home/feng/Downloads/xulrunner-1.9.2.7-2.fc13.i686.rpm
error: Failed dependencies:
xulrunner >= 1.9.2.4 conflicts with firefox-3.6.3-4.fc13.i686
[root@fsc /]# rpm -ivhf /home/feng/Downloads/xulrunner-1.9.2.7-2.fc13.i686.rpm /home/feng/Downloads/firefox-3.6.7-1.fc13.i686.rpm
error: Failed dependencies:
xulrunner >= 1.9.2.4 conflicts with firefox-3.6.3-4.fc13.i686
[root@fsc /]# rpm -ivh /home/feng/Downloads/firefox-3.6.7-1.fc13.i686.rpm error: Failed dependencies:
xulrunner >= 1.9.2.7-1 is needed by firefox-3.6.7-1.fc13.i686
[root@fsc /]# rpm --help|grep force
--force                          short hand for --replacepkgs --replacefiles
(--force on upgrades does this
[root@fsc /]# rpm -ivh --force /home/feng/Downloads/xulrunner-1.9.2.7-2.fc13.i686.rpm /home/feng/Downloads/firefox-3.6.7-1.fc13.i686.rpm
error: Failed dependencies:
xulrunner >= 1.9.2.4 conflicts with firefox-3.6.3-4.fc13.i686
[root@fsc /]# rpm -ivh  /home/feng/Downloads/xulrunner-1.9.2.7-2.fc13.i686.rpm /home/feng/Downloads/firefox-3.6.7-1.fc13.i686.rpm  --nodeps --force
Preparing...                ########################################### [100%]
1:xulrunner              ########################################### [ 50%]
2:firefox                ########################################### [100%]
[root@fsc /]# rpm -q firefox
firefox-3.6.3-4.fc13.i686
firefox-3.6.7-1.fc13.i686
[root@fsc /]# rpm -ev firefox-3.6.3-4.fc13.i686
[root@fsc /]# rpm -q firefox
firefox-3.6.7-1.fc13.i686
[root@fsc /]# rpm -ev xulrunner-1.9.2.3-1.fc13.i686
error: Failed dependencies:
gecko-libs = 1.9.2.3 is needed by (installed) gnome-python2-gtkmozembed-2.25.3-17.fc13.i686
gecko-libs = 1.9.2.3 is needed by (installed) Miro-3.0-1.fc13.i686
xulrunner = 1.9.2.3-1.fc13 is needed by (installed) xulrunner-devel-1.9.2.3-1.fc13.i686

php在windows2003/IIS下安装php程序运行错误“您未被授权查看该页”

核心:给php安装目录赋上users组读与执行权限

环境:新安装服务器,windows2003/iis,windows安装目录C盘的权限设置很严格,很多没有必要的的用户权限都删掉了。
配置php
php文件解压缩到c:\php5;
设置系统变量:path增加c:\php5,新建一个系统变量PHPRC值为c:\php5;
拷一个配置好的php.ini文件到c:\php5;
iis站点里设置php文件映射,新增加isapi.dll的web服务扩展,并设置为启用状态;
重启windows;

然后,运行一个phpinfo.php的测试文件(文件内容为<%php phpinfo(); %>),用以检测安装是否正确。
但很奇怪的是出现“您未被授权查看该页”的错误。突然想起来,要对pho.ini设置web站点用户的读与执行权限,于是赶快给php.ini文件赋iis_web组的读与执行权限。再执行,还是看到“您未被授权查看该页”错误页。单独对iis站点用户赋权限也还是不行。
[注]iis_web组是所有web站点用户的组,没有赋什么特殊权限,只对各自iis站点目录赋相应权限。这也是“最小权限”原则。

好像之前没有遇到这样的问题。仔细分析一下,该站点下的.asp文件,html文件都可以正常运行,但就是php提示没有权限。可以肯定,这里的错误跟iis本身没关系,问题还是在于php配置。
准备一项一项的试。
首先给php.ini赋everyone读与执行的权限,不对。删除该权限(目的:尽量不多赋权限 --安全方面还是要发扬一毛不拔的精神!)
对php5目录赋everyone读与执行权限,运行,正常了,可以看到正常的配置信息。
运行是正常了,但给everyone赋了执行权限,总是感觉不大安心。于是删掉该权限,找“最小权限”。
执行phpinfo.php,还是可以正常显示信息。以为是浏览器缓存,在地址栏里加了个?sdfdsgewf还还是可以正常访问的。原因是模块安装php,php.ini只在启动时读取一次,接下来就不需要了。于是命令行里运行iisreset重启iis,再访问,果然看到“您未被授权查看该页”的消息了。
感觉php运行时,需要使用php5目录下的相关文件,需要有相关权限,于是给users组赋读与执行的权限,这下就好了。看来找到原因了,但具体是user组的哪个用户呢,查看本地用户和组里的users,里面只有如图的三个用户,到用户里找,除aspnet外两个却没有对应,看来这里是windows某个内部用户了,大概无法进一步找下去了,只好收手,保留php安装目录的users组读与执行权限。或许只给aspnet用户赋权限就可以了,但没有试,有兴趣的同学可以试试。要回去吃饭了——其实是要先吃饭再回去,都20:22了!

apache/重装windows后如何修复apache2,并注册为系统服务

一般来说首次安装apache时建议安装到非windows系统所在分区,这样在windows崩溃重装后,可以不用再次进行“安装配置apache”这样重复性工作,而是直接重新注册apache为系统服务就很可以了。

这里讲一下apache重新注册为系统服务的方法(这里以apache2.0.55 win32版为例说明)。

软件的说明文档是很有用的东西,比用google在无数的结果里找寻更更准确;当然,很多软件——尤其是自由软件free software——多是英文文档,因此直接看文档常常会有一些难度。笔者的E文也不好,看还是尽量看一些英文文档,个人认为这是很有用的。

apache安装目录里有bin/目录,apache的可执行程序就在这里,里面最主要的就是Apache.exe (某些版本可能是httpd.exe)

查看apache.exe的帮助文档,在命令行里执行:

httpd.exe -?

得到如下的说明:

D:\Program Files\Apache Group\Apache2\bin>Apache.exe -?
Usage: Apache.exe [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-w] [-k start|restart|stop|shutdown]
[-k install|config|uninstall] [-n service_name]
[-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
-D name           : define a name for use in <IfDefine name> directives
-d directory      : specify an alternate initial ServerRoot
-f file           : specify an alternate ServerConfigFile
-C "directive"    : process directive before reading config files
-c "directive"    : process directive after reading config files
-n name           : set service name and use its ServerConfigFile
-k start          : tell Apache to start
-k restart        : tell running Apache to do a graceful restart
-k stop|shutdown  : tell running Apache to shutdown
-k install        : install an Apache service
-k config         : change startup Options of an Apache service
-k uninstall      : uninstall an Apache service
-w                : hold open the console window on error
-e level          : show startup errors of level (see LogLevel)
-E file           : log startup errors to file
-v                : show version number
-V                : show compile settings
-h                : list available command line options (this page)
-l                : list compiled in modules
-L                : list available configuration directives
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S                : a synonym for -t -D DUMP_VHOSTS
-t                : run syntax check for config files

注意其中参数 -k install,就是注册为系统服务的,

在命令行里执行

D:\Program Files\Apache Group\Apache2\bin>Apache.exe -k install

就可以了,执行完毕后,并没有消息提示,看到系统服务里可以看到 apache2 这样服务的存在.

Apache.exe注册为windows服务时还可以使用以下参数:
apache -k install -n "服务名"
要安装一个使用特定配置的服务,安装时指定配置文件:
apache -k install -n "服务名" -f "\my server\conf\my.conf"
要移除一个Apache服务,使用:
apache -k uninstall -n "服务名"
如果没有指定服务名,缺省地,将使用"Apache2"。