我得到这个也有一个PHP框架,允许网址格式,这样
index.php?controller=doohickey&id=z61
可以沿着改写为
index.php/controller/doohickey/z61
在框架代码中使用正则表达式。
的错误看起来像(在/ var /日志/阿帕奇/ error_log中):
GET /index.php/accounts_badoink/confirmaction/WUW%253DWBW%25253DV0tXPWM3Nzc1....
- >在这种情况下,Apache是分析文件名作为
/index.php/accounts_badoink/confirmaction/WUW%253DWBW%25253DV0tXPWM3Nzc1....
(我序列化一个对象状态并传递它)。
我不得不重写这个(至少与长所附序列化对象的URL)到更常规样式:
GET /index.php?controller=accounts_badoink&confirmaction=WUW%253DWBW%25253DV0tXPWM3Nzc1....
- >在这种情况下,Apache是解析的文件名作为index.php
因此,简而言之,应尽早重写URL并包含?
,以便将数据作为CGI样式参数而不是路径元素传递。
我跑strace -p $PID &
每个Apache进程ID(如报告pidof apache2
):
# pidof apache2 | tr ' ' '\n' | grep -v 21561 | sed "s|\(.*\)|strace -p \1 \&|g" | sh -
完成:
# kill -HUP `pidof strace`
而看到内核调用使通过的Apache2:
accept(3, {sa_family=AF_INET, sin_port=htons(38985), sin_addr=inet_addr("127.0.0.1")}, [16]) = 13
fcntl(13, F_GETFD) = 0
fcntl(13, F_SETFD, FD_CLOEXEC) = 0
fcntl(13, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(13, F_SETFL, O_RDWR|O_NONBLOCK) = 0
read(13, "GET /newregcon/index.php/account"..., 8000) = 4949
write(2, "[Wed May 11 15:39:36 2011] [erro"..., 4451) = 4451
writev(13, [{"HTTP/1.1 403 Forbidden\r\nDate: We"..., 219}, {"<!DOCTYPE HTML PUBLIC \"-//IETF//"..., 4610}], 2) = 4829
由于这些系统调用不会返回错误(例如'...= -1' ),我下载apache2的来源,结果发现:
grep命令 “不能图”:
server/core.c
3489:AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r)
3490:{
3520: if ((rv = apr_filepath_merge(&r->filename, conf->ap_document_root, path,
3521: APR_FILEPATH_TRUENAME
3522: | APR_FILEPATH_SECUREROOT, r->pool))
3523: != APR_SUCCESS) {
3524: ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
3525: "Cannot map %s to file", r->the_request);
3526: return HTTP_FORBIDDEN;
3527: }
找apr_filepath_merge
...
srclib/apr/file_io/unix/filepath.c
81:APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
82: const char *rootpath,
83: const char *addpath,
84: apr_int32_t flags,
85: apr_pool_t *p)
86:{
87: char *path;
88: apr_size_t rootlen; /* is the length of the src rootpath */
89: apr_size_t maxlen; /* maximum total path length */
149: rootlen = strlen(rootpath);
150: maxlen = rootlen + strlen(addpath) + 4; /* 4 for slashes at start, after
151: * root, and at end, plus trailing
152: * null */
153: if (maxlen > APR_PATH_MAX) {
154: return APR_ENAMETOOLONG;
155: }
找到APR_PATH_MAX
...
的Netware
./srclib/apr/include/apr.hnw:424:#define APR_PATH_MAX PATH_MAX
WIN32
./srclib/apr/include/apr.hw:584:#define APR_PATH_MAX 8192
./srclib/apr/include/apr.h.in
/* header files for PATH_MAX, _POSIX_PATH_MAX */
#if APR_HAVE_LIMITS_H
#include <limits.h>
在/ usr/src/linux目录-headers-2.6.35-28/include/linux/limits.h
#define PATH_MAX 4096 /* # chars in a path name including nul */
这是否'<..大量的javascript ..>''意味着它有很多'&file.js&file2.js'吗?如果是这样,那么将需要缩短它。如果你指定了你正在使用的插件,以及'<..很多JavaScript ...>'里面有什么,它会更有帮助。 (Just javascript code?) – Haochi 2011-03-17 11:24:22
<..很多的JavaScript ..>是JavaScript源代码,而不是文件名。 – 2011-03-17 12:15:39