Rexdf

The devil is in the Details.

折腾日记

| Comments

昨晚没有刷题,早上8点就醒了,没事做。便折腾了一下网站。
因为听说**Cloud比较好用,便尝试着用了下,暂时买找到窍门,下载Cygwin大约近10G的大小了(我有完整版安装软件的癖好),而使用BitVise似乎无从下手,只有等待完全装好Cygwin后再说了。
虽然现在海盗湾已经重新开张,但是上次海盗湾停止运营前的一个版本,22G的数据库被我下载了下来,单从配置来看是需要lighttpd服务器跑的。

1.Apache下面尝试

我尝试着在Apache下跑跑,问题不少,应该是可以完美移植的,关键在于路径重写上面:

# These are my mod_rewrite rules:
url.rewrite = (
	"^/browse$" => "/cats.php",
	"^/browse/(\d+)$" => "/browse.php?cat=$1",
	"^/browse/(\d+)/(\d+)$" => "/browse.php?cat=$1&page=$2",
	"^/recent$" => "/browse.php",
	"^/recent/(\d+)$" => "/browse.php?page=$1",
	"^/search/([^/]+)$" => "/browse.php?q=$1",
	"^/search/([^/]+)/(\d+)$" => "/browse.php?q=$1&page=$2",
	"^/s\?(.+)$" => "/browse.php?$1&redir",
	"^/details/(\d+)$" => "/details.php?id=$1",
	"^/details/(\d+)/(.+)$" => "/details.php?id=$1&q=$2",
	"^/torrent/(\d+)$" => "/torrent.php?id=$1",
	"^/about$" => "/about.php",
	"^/about\?(.+)$" => "/about.php?$1",
	"^/searchplugin$" => "/searchplugin.php",
)

2.神奇的Rewrite伪静态规则转换工具

被我无意中找到一个神奇的网站http://www.onexin.net/rewrite.php,可以转化配置文件,先从lighttpd转换到Nginx,然后再逆向到apache,如此一来,居然真的可以跑起来,看到了站点的内容:

RewriteEngine on
RewriteRule ^browse$ cats.php
RewriteRule ^browse/(d+)$ browse.php?cat=$1
RewriteRule ^browse/(d+)/(d+)$ browse.php?cat=$1&page=$2
RewriteRule ^recent$ browse.php
RewriteRule ^recent/(d+)$ browse.php?page=$1
RewriteRule ^search/([^/]+)$ browse.php?q=$1
RewriteRule ^search/([^/]+)/(d+)$ browse.php?q=$1&page=$2
RewriteRule ^s?(.+)$ browse.php?$1&redir
RewriteRule ^details/(d+)$ details.php?id=$1
RewriteRule ^details/(d+)/(.+)$ details.php?id=$1&q=$2
RewriteRule ^torrent/(d+)$ torrent.php?id=$1
RewriteRule ^about$ about.php
RewriteRule ^about?(.+)$ about.php?$1
RewriteRule ^searchplugin$ searchplugin.php

  图片中的链接是正确的,但是不知道.htaccess 哪里写得不好,好像无论访问哪里都会被重定向到/recent,所以决定试下lighttpd。

3.LightTPD for Windows

虽然知道在Cygwin下面是可以直接编译Linux版本的Lighttpd的,但是如果要那么做,我觉得还不如重启,但是Cygwin还在10G左右的在线完整版安装中。于是 到http://en.wlmp-project.net下载了LightTPD for Windows,挺小的只有5M多一点,简单的配置之后,却是怎么也跑不起来。

2012-07-30 18:01:22: (server.c.628) trying to read configuration (test mode)
2012-07-30 18:01:22: (configfile.c.1278) a default document-root has to be set
2012-07-30 18:01:22: (server.c.664) setting default values failed

纠结中,试了下打开命令行,把当前目录换到LightTPD.exe所在的目录,再次运行LightTPD.exe -f conf/lighttpd.conf就Ok了。估计即使不在LightTPD.exe所在目录,-f后面传绝对目录也应该是可以的。

4.php异常

然后打开php却出了莫名的问题:

Warning: PHP Startup: Unable to load dynamic library 'D:/Users/Rexdf/php545/ext\php_interbase.dll' - The specified module could not be found. in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'D:/Users/Rexdf/php545/ext\php_zip.dll' - The specified module could not be found. in Unknown on line 0
 X-Powered-By: PHP/5.4.5 Content-Type: text/html; charset=utf-8

  网上说“ 解决的办法有两个: 1 将这些依赖的dll拷贝到%windir%/system32下 2 或者将PHP5的安装目录添加到%PATH%中。 无论那个都可以很好地达到我们地目的。 够简单的,但是有时候还就想不到哪儿去。 到底哪些扩展依赖哪些dll呢?以下列表可以帮助我们回答这个问题:

php_curl.dll CURL, Client URL library functions Requires: libeay32.dll, ssleay32.dll (bundled)
php_domxml.dll DOM XML functions PHP <= 4.2.0 requires: libxml2.dll
(bundled) PHP >= 4.3.0 requires: iconv.dll (bundled)
php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
gnu_gettext.dll (bundled), PHP >= 4.2.3 requires libintl-1.dll,
php_iconv.dll ICONV characterset conversion Requires: iconv-1.3.dll
php_ingres.dll Ingres II functions Requires: Ingres II libraries
php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
php_java.dll Java functions PHP <= 4.0.6 requires: jvm.dll (bundled)
php_ldap.dll LDAP functions PHP <= 4.2.0 requires libsasl.dll(bundled),
PHP >= 4.3.0 requires libeay32.dll,ssleay32.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)
php_msql.dll mSQL functions Requires: msql.dll (bundled)
php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll (bundled)
php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysqli.dll (bundled)
php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll (bundled)
php_xslt.dll XSLT functions PHP <= 4.2.0 requires sablot.dll, expat.dll (bundled).
PHP >= 4.2.1 requires sablot.dll, expat.dll, iconv.dll (bundled).

” 我只是试了下第二种方法,无果。包括关闭了命令行,重新启动Lighttpd。

5.本地的海盗湾OK了

无奈,直接在php.ini注释掉了extension=php_zip.dll和extension=php_interbase.dll,然后自然就OK了,当然主要原因是我没找到gds32.dll 和php_zip.dll依赖文件。不然可以尝试Regsvr32试试。下面是最后截图:

Comments