修复 Simple PHP Blog 的页面跳转错误 

我不知道这篇文章该不该写在这里,因为严格意义上来讲,它不算是GNU/Linux 相关的问题。

不过,考虑这个站点是架设在 sphpblog 上的,所以姑且算作是有点关系吧。

是这样的,自从我升级到sphpblog 7.0 以来,我发现一个问题,那就是每当我提交完文章,或者提交完相关的表单操作。

sphpblog 都会将我跳转到 "http://domain.comindex.php" 这个地址。

很明显,它忘了在域名和子级路径之间加“/”了。

这的确很坑爹。每次我都会被送到中国电信的114错误页面,莫名的恼火~

于是,今天正好有时间,看看源码。发现它是在保存完毕后,调用了一个叫“redirect_to_url()” 的函数来实现跳转。

而这个函数位于scripts 目录下的 sb_login.php 文件里,具体内容
参见SVN:http://sphpblog.svn.sourceforge.net/viewvc/sphpblog/trunk/scripts/sb_login.php?revision=217&view=markup

可以看到,该函数还用到了一个叫“baseurl()” 的函数,这个不去管它。

只要把178行的
header('Location: ' . $baseurl . $relative_url);
改成
header('Location: ' . $baseurl . "/" . $relative_url);
即可。

保存下。

看看,是不是跳转成功了?!

注:这已经不是"redirect_to_url()" 这个函数第一次出现问题了,之前也有过一次类似坑爹的问题.
参见官方tracker:
http://sourceforge.net/tracker/index.ph ... tid=645297
[ ] ( 1978 次浏览 ) 永久链接 ( 3.2 / 2370 )
CentOS 下让Nginx 目录列表使用本地时区 

之前我记得nginx 默认目录列表下文件的时间戳使用的是UTC时区。我一直想把它设置成使用指定时区,如CST.

为此,我曾经还在nginx 的邮件列表里面和别人讨论过这个问题,
参见:http://forum.nginx.org/read.php?2,214494,214494#msg-214494

不过当时是无果。之后,我也就放弃了。

不过,直到刚才,我无意中发现了“autoindex_localtime” 这个参数,在nginx 配置文档里面。

我才发现我绕了一个大弯~

于是乎,果断加入该syntax,结果如下:

server {
listen 82;
server_name ftp.xiazhengxin.name;
charset utf-8;
autoindex on;
autoindex_localtime on; # 使用本地时区
autoindex_exact_size off; # 使用可读大小
root /home/ftp/;
allow 127.0.0.1;
deny all;
}


保存下,重载配置文件.
nginx -s reload.

打开 http://ftp.xiazhengxin.name/xzx/sql/ 页面,果然所有备份的数据库文件的时间戳都是凌晨0点00分了。

这就对了~哈哈!困扰了我许久的坑爹的问题终于被解决了。

其实这个问题早就应该被干掉的。因为根据nginx svn 库的提交显示,"autoindex_localtime" 这个参数并不是最近才有的,而是早在2005年就被加入了nginx~ 囧

参见:http://trac.nginx.org/nginx/changeset/520/nginx

注:本文在撰写和测试时,参考了以下文档:
http://nginx.org/en/docs/http/ngx_http_ ... _localtime
[ ] ( 1826 次浏览 ) 永久链接 ( 2.9 / 2397 )
Linux Mint Lisa LXDE 恢复桌面默认右键菜单 

刚接触LXDE界面,感觉很清新。这种简洁、朴素的UI很是让我喜欢。

由于LXDE默认使用的openbox 窗口管理器,一次在设置桌面喜好的时候,不知道勾选了什么。导致桌面上的右键菜单变成了openbox的右键菜单了。

很是不习惯。特别是需要在桌面上建立个空白文档什么的。

在PCManFM(LXDE 默认的文件管理器)里是正常的。

通过仔细的查找,终于在“桌面偏好设置”里面找到了该选项。

或者在终端里运行:“pcmanfm --desktop-pref” 即可。

对比图见下:
使用openbox菜单:


使用系统默认菜单:


怎么样?是不是恢复了? :)

注:本文在撰写时,参考了以下文章:
http://forums.linuxmint.com/viewtopic.p ... mp;t=98427
[ ] ( 1797 次浏览 ) 永久链接 ( 3 / 2257 )
解决GNU/Linux 下 adobe flash player 乱码 

前两天刚安装好Linux Mint Lisa LXDE,今天打算去acfun.tv 看一些搞笑视频,结果发现一个很杯具的问题,那就是我浏览器的flash player 里面的中文字体全部变成方块了~

这个问题,我记得我以前解决过一次,那是我还在用Ubuntu的时候,看CNZZ 后台flash报表遇到的。

由于年代久远,实在是记不起来了,好像是字体的问题。

于是,果断谷歌。

网络上给出的答案基本就是删除位于 /etc/fonts/conf.d/ 下的 49-sansserif.conf 软链接文件。


sharl@sharl-laptop /etc/fonts/conf.d $ ls -lah | grep 49
lrwxrwxrwx 1 root root 31 2012-03-28 21:45 49-sansserif.conf -> ../conf.avail/49-sansserif.conf


可是,很遗憾的是,没鸟用。我试了。

真是坑爹阿,无奈只好再次搜索下~ 最后在launchpad 找到了关于这个问题的bug提交。

参见:https://bugs.launchpad.net/ubuntu/+source/flashplugin-nonfree/+bug/207198

我察,adobe f*ck you~

launchpad 里面给出了一些比较有用的解决方案,应该说是比较靠谱的~

即:
编辑zh-cn 对应的字体映射配置文件,69-language-selector-zh-cn.conf

sharl@sharl-laptop /etc/fonts/conf.d $ ls -lah | grep cn
lrwxrwxrwx 1 root root 53 2012-03-22 22:15 69-language-selector-zh-cn.conf -> /etc/fonts/conf.avail/69-language-selector-zh-cn.conf


把文泉驿的中文字体的优先级放到该列表的最上方,压过其他坑爹的字体。
修改后如下:

sharl@sharl-laptop /etc/fonts/conf.d $ cat 69-language-selector-zh-cn.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<match target="pattern">
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Serif</string>
<string>Bitstream Vera Serif</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Sans</string>
<string>Bitstream Vera Sans</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Sans Mono</string>
<string>Bitstream Vera Sans Mono</string>
<string>Droid Sans Fallback</string>
<string>HYSong</string>
<string>AR PL UMing CN</string>
<string>AR PL UMing HK</string>
<string>AR PL ShanHeiSun Uni</string>
<string>AR PL New Sung</string>
<string>AR PL UKai CN</string>
<string>AR PL ZenKai Uni</string>
</edit>
</match>

</fontconfig>


保存之后,再重启浏览器,flash player 果然不乱码了~

查看下字体:

sharl@sharl-laptop /etc/fonts/conf.d $ fc-match -a | grep Wen
wqy-microhei.ttc: "WenQuanYi Micro Hei" "Regular"
wqy-microhei.ttc: "WenQuanYi Micro Hei Mono" "Regular"

应该是正常了。

最后我想说两点:
1.Adobe Flash Player 真烂~
2.国内不负责任的转载伤不起

注:本文在撰写的时候参考了一下文章:
http://forum.ubuntu.org.cn/viewtopic.ph ... 5#p1865165
[ ] ( 2232 次浏览 ) 永久链接 ( 3.1 / 2684 )
升级安装 php 5.4.0 和 nginx 1.1.17 

阳光明媚的下午,闲来无事。正好想起上周nginx 发布了一个修复内存泄漏的漏洞,再加上php 的5.4正好也正式发布了。于是,便打算升级跟进。

下载源码:
16 wget http://cn2.php.net/distributions/php-5.4.0.tar.bz2
17 wget http://nginx.org/download/nginx-1.1.17.tar.gz

删除久档:
[root@PowerPC pub]# rm php*
rm:是否删除 一般文件 “php-5.4.0RC4.tar.bz2”? y
rm:是否删除 一般文件 “php-5.4.0.tar.bz2”? n
rm:是否删除 一般文件 “phpinfo.php”? n
[root@PowerPC pub]# rm nginx*
rm:是否删除 一般文件 “nginx-1.1.11.tar.gz”? y
rm:是否删除 一般文件 “nginx-1.1.17.tar.gz”? n

停掉服务器,删除旧版本程序文件,顺便备份下配置文件。

先是php,解压源码包,进入目录:
我的configure:
[root@PowerPC php-5.4.0]# ./configure \
> --prefix=/usr/local/php \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/php \
> --localstatedir=/var \
> --disable-cli \
> --enable-embed=shared \
> --enable-fpm \
> --with-fpm-user=http \
> --with-fpm-group=web \
> --with-config-file-path=/etc/sysconfig/php \
> --with-config-file-scan-dir=/etc/sysconfig/php \
> --enable-sigchild \
> --disable-ipv6 \
> --with-pcre-regex \
> --with-zlib \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-dba=shared \
> --enable-exif \
> --enable-ftp \
> --with-gd \
> --with-mhash \
> --enable-intl \
> --enable-mbstring \
> --with-mcrypt \
> --with-mysql=/usr/local/mysql \
> --with-mysql-sock=/tmp/mysql.sock \
> --with-mysqli=/usr/local/bin/mysql_config \
> --disable-pdo \
> --with-libedit \
> --enable-soap \
> --enable-sockets \
> --enable-wddx \
> --with-xmlrpc \
> --with-xsl \
> --enable-zip \
> --without-pear

检查依赖,无问题。make 编译。时间较长,差点死机~
Linux mint 真是不给力阿~

完成后,make install 安装。
紧接着,恢复配置文件。

查看版本号:
[root@PowerPC php-5.4.0]# php-fpm -v
PHP 5.4.0 (fpm-fcgi) (built: Mar 24 2012 17:40:55)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

然后是nginx,解压,进入目录:
我的configure:
[root@PowerPC nginx-1.1.17]# ./configure \
> --prefix=/usr/local/nginx \
> --sbin-path=/usr/local/sbin/nginx \
> --conf-path=/etc/sysconfig/nginx/nginx.conf \
> --error-log-path=/var/log/nginx/error.log \
> --pid-path=/var/run/nginx.pid \
> --lock-path=/var/run/nginx.lock \
> --user=http \
> --group=web \
> --with-select_module \
> --with-poll_module \
> --with-http_image_filter_module \
> --with-http_dav_module \
> --with-http_flv_module \
> --with-http_mp4_module \
> --with-http_gzip_static_module \
> --without-http_geo_module \
> --without-http_rewrite_module \
> --without-http_proxy_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx/request \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --with-pcre

检查依赖,通过。给出编译概况:
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/etc/sysconfig/nginx"
nginx configuration file: "/etc/sysconfig/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/tmp/nginx/request"

确认无误,开始编译安装。
make && make install

最后恢复下配置文件,OK了。

查看版本号:
[root@PowerPC nginx-1.1.17]# nginx -v
nginx version: nginx/1.1.17

恩,看起来,一切都很顺利。

重新启动服务,网站正常。至此,升级成功。
[ ] ( 3266 次浏览 ) 永久链接 ( 3 / 2449 )

<< <上一页 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 下一页> >>