PHP $ _COOKIE没有完全填充

时间:2015-09-06 20:39:28

标签: php apache laravel cookies

我花了一些时间试图追踪a particular Laravel bug的根本原因,因为最初的GitHub问题在未经解决的情况下被关闭。

经过一段时间的实验后,我发现会话正在重新生成,因为laravel_session Cookie设置为null。尽可能追溯到这一点,我发现在index.php - 在Laravel 加载之前 - $_COOKIE的值已损坏...有时候

大约90%的时间我打电话给我的应用程序时,我的cookie看起来像这样:

array:7 [
  "__unam" => "bc7c68-14f8d12a5ef-43097c02-213"
  "__utma" => "152883115.857409601.1438038184.1440538193.1440976773.14"
  "__utmc" => "152883115"
  "__utmz" => "152883115.1435960225.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
  "PHPSESSID" => "k8qvmt8ccbhcqepbn7mib8kra6"
  "XSRF-TOKEN" => "eyJpdiI6IlJGd2M1WHlRcnhpeGtobFZpVlZaWmc9PSIsInZhbHVlIjoiMXhFSnlHeTZKbkc5NWxYcFwvNkNUTkNXeVpROWIweGJkczhIXC9LVStNMVlvSjFoRmttTXlLeTVOS01JM0wrN2FCdjVvQzM2RHNwRjJQcGlTNWZyelM2QT09IiwibWFjIjoiZDdjMzk1Zjg0YWUzYjhlNzUyYmQ4NzAwNTFhZWIwNDM1MDQyYmMwZjZkODllMTVlMGMxNTVjZjBmNTlmMTlkNiJ9"
  "laravel_session" => "eyJpdiI6InV4YmFFTzJxTTdrVGlPdjVQZkszS1E9PSIsInZhbHVlIjoieGdsYzJTYTlqY3k4MzFIR2l6b2ZSaFwvK1RmdGg1UUhYR2dkdVpmNVVvcHoyMm5yRUpMUWRGRjVZd3ZUXC81OXl1QnpBRnR3a05kNXp1MEFoV2pLTmpIdz09IiwibWFjIjoiOThjMTU1MTE0ZTRjM2E2MGEzNGQ0MTcwODNhZmNlODMyZjM0MGViMjdmZjliMWZhNjE2M2Q0YzFlNWQxZDZiYyJ9"
]

但是有10%的时间,它看起来像是这样:

array:7 [
  "__unam" => "bc7c68-14f8d12a5ef-43097c02-213"
  "__utma" => "152883115.857409601.1438038184.1440538193.1440976773.14"
  "__utmc" => "152883115"
  "__utmz" => "152883115.1435960225.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
  "PHPSESSID" => "k8qvmt8ccbhcqepbn7mib8kra6"
  "XSRF-TOKEN" => "eyJpdiI6IlJGd2M1WHlRcnhpeGtobFZpVlZaWmc9PSIsInZhbHVlIjoiMXhFSnlHeTZKbkc5NWxYcFwvNkNUTkNXeVpROWIweGJkczhIXC9LVStNMVlvSjFoRmttTXlLeTVOS01JM0wrN2FCdjVvQzM2RHNwRjJQcGlTNWZyelM2QT09IiwibWFjIjoiZDdjMzk1Zjg0YWUzYjhlNzUyYmQ4NzAwNTFhZWIwNDM1MDQyYmMwZjZkODllMTVlMGMxNTVjZjBmNTlmMTlkNiJ9"
  "laravel_session" => "eyJpdiI6InV4YmFFTzJxTTdrVGlPdjVQZkszS1E9PSIsInZhbHVlIjoieGdsYzJTYTlqY3k4MzFIR2l6b2ZSaFwvK1RmdGg1UUhYR2dkdVpmNVVvcHoyMm5yRUpMUWRGRjVZd3Z"
]

使用网络代理(Charles)监控网络流量,我的问题是 - 正在发送完整的Cookie字符串,但服务器只看到部分消息( laravel_session cookie被切断了)

每次出现问题时,它都会在完全相同位置被切断:cookie字符串开始后的678个字节(原始HTTP请求文本中为1435个字节)。奇怪的是,请求正文在没有任何损害的情况下传输,并且在原始HTTP请求中的之后,因此它不是TCP连接失败的问题。

PATCH /api/employees/1 HTTP/1.1
Host: www.mywebsite.com
Content-Length: 23
Accept: application/json, text/plain, */*
Origin: http://www.mywebsite.com
X-XSRF-TOKEN: eyJpdiI6IlJGd2M1WHlRcnhpeGtobFZpVlZaWmc9PSIsInZhbHVlIjoiMXhFSnlHeTZKbkc5NWxYcFwvNkNUTkNXeVpROWIweGJkczhIXC9LVStNMVlvSjFoRmttTXlLeTVOS01JM0wrN2FCdjVvQzM2RHNwRjJQcGlTNWZyelM2QT09IiwibWFjIjoiZDdjMzk1Zjg0YWUzYjhlNzUyYmQ4NzAwNTFhZWIwNDM1MDQyYmMwZjZkODllMTVlMGMxNTVjZjBmNTlmMTlkNiJ9
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
Content-Type: application/json;charset=UTF-8
Referer: http://www.mywebsite.com/admin/employees?location=1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: __unam=bc7c68-14f8d12a5ef-43097c02-213; __utma=152883115.857409601.1438038184.1440538193.1440976773.14; __utmc=152883115; __utmz=152883115.1435960225.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=k8qvmt8ccbhcqepbn7mib8kra6; XSRF-TOKEN=eyJpdiI6IlJGd2M1WHlRcnhpeGtobFZpVlZaWmc9PSIsInZhbHVlIjoiMXhFSnlHeTZKbkc5NWxYcFwvNkNUTkNXeVpROWIweGJkczhIXC9LVStNMVlvSjFoRmttTXlLeTVOS01JM0wrN2FCdjVvQzM2RHNwRjJQcGlTNWZyelM2QT09IiwibWFjIjoiZDdjMzk1Zjg0YWUzYjhlNzUyYmQ4NzAwNTFhZWIwNDM1MDQyYmMwZjZkODllMTVlMGMxNTVjZjBmNTlmMTlkNiJ9; laravel_session=eyJpdiI6InV4YmFFTzJxTTdrVGlPdjVQZkszS1E9PSIsInZhbHVlIjoieGdsYzJTYTlqY3k4MzFIR2l6b2ZSaFwvK1RmdGg1UUhYR2dkdVpmNVVvcHoyMm5yRUpMUWRGRjVZd3ZUXC81OXl1QnpBRnR3a05kNXp1MEFoV2pLTmpIdz09IiwibWFjIjoiOThjMTU1MTE0ZTRjM2E2MGEzNGQ0MTcwODNhZmNlODMyZjM0MGViMjdmZjliMWZhNjE2M2Q0YzFlNWQxZDZiYyJ9

{"id":"1","show":false}

我正在使用PHP的内置开发服务器(php -S 0.0.0.0:80)。我尝试使用Apache来查看它是否解决了这个问题,而且似乎就像Cookie字符串总是正确地与Apache一起遇到的那样,我又遇到了另一个错误,即PHP完全崩溃并在遇到问题时烧伤file_put_contents致电。我有以下代码:

try {
    echo "Writing... (LOCK_EX: " . LOCK_EX . ")<br />\n";
    file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    echo "Done.";
} catch( Exception $e ) {
    echo "WHAT";
}
echo "Failed?";

仅返回Writing... (LOCK_EX: 2)<br />\n

没有&#34;完成。&#34;,&#34;什么&#34;或&#34;失败?&#34;显示。

ps all查看服务器是否挂起,我甚至都看不到Apache进程。但是我知道Apache正在运行,因为如果我停止Apache(sudo apachectl stop),我就会停止从服务器获取任何响应

4     0   807     1  20   0  15820   912 n_tty_ Ss+  tty4       0:00 /sbin/getty -8 38400 tty4
4     0   810     1  20   0  15820   916 n_tty_ Ss+  tty5       0:00 /sbin/getty -8 38400 tty5
4     0   815     1  20   0  15820   916 n_tty_ Ss+  tty2       0:00 /sbin/getty -8 38400 tty2
4     0   816     1  20   0  15820   920 n_tty_ Ss+  tty3       0:00 /sbin/getty -8 38400 tty3
4     0   819     1  20   0  15820   916 n_tty_ Ss+  tty6       0:00 /sbin/getty -8 38400 tty6
4     0  1029     1  20   0  15820   916 n_tty_ Ss+  tty1       0:00 /sbin/getty -8 38400 tty1
0     0  1057  9241  20   0  10016   880 -      R+   pts/2      0:00 ps all
0     0  5278  9239  20   0  12404  1212 wait   Ss   pts/8      0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0  5279  5278  20   0  22708  3660 n_tty_ S+   pts/8      0:00 bash -l
0     0  9240  9239  20   0  12404  1144 wait   Ss   pts/2      0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0  9241  9240  20   0  22776  3868 wait   S    pts/2      0:00 bash -l
0     0  9287  9239  20   0  12404  1148 wait   Ss   pts/4      0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0  9288  9287  20   0  22792  4040 n_tty_ S+   pts/4      0:02 bash -l
0     0 10740  9239  20   0  12404  1152 wait   Ss   pts/5      0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0 10741 10740  20   0  22756  3836 n_tty_ S+   pts/5      0:00 bash -l
0     0 17522 17476  20   0   1924   512 poll_s Ss+  pts/1      0:00 /root/.c9/bin/tmux -u2 -L cloud91.9 attach -t user@server_668 -d
0     0 18258 17476  20   0   1924   516 poll_s Ss+  pts/3      0:00 /root/.c9/bin/tmux -u2 -L cloud91.9 attach -t user@server_14 -d
0     0 20097  9239  20   0  12404  1204 wait   Ss   pts/9      0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0 20098 20097  20   0  22708  3808 wait   S    pts/9      0:00 bash -l
0     0 20134 20098  20   0 103624  2880 n_tty_ S+   pts/9      0:00 mysql -u root -p
0     0 30986 17476  20   0   1924   516 poll_s Ss+  pts/7      0:00 /root/.c9/bin/tmux -u2 -L cloud91.9 attach -t user@server_836 -d
0     0 31599  9239  20   0  12404  1204 wait   Ss   pts/6      0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0 31603 31599  20   0  22708  3636 n_tty_ S+   pts/6      0:00 bash -l
0     0 31632  9239  20   0  12404  1152 wait   Ss   pts/10     0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0 31633 31632  20   0  22760  3828 n_tty_ S+   pts/10     0:00 bash -l
0     0 31811  9239  20   0  12404  1152 wait   Ss   pts/12     0:00 bash -c export ISOUTPUTPANE=0;bash -l
0     0 31812 31811  20   0  22708  3520 n_tty_ S+   pts/12     0:00 bash -l

我真的不确定发生了什么(为什么Apache失败或为什么PHP内置服务器会切断我的$_COOKIE变量)。

作为最后一点,我已经检查了我试图写入的文件的权限:

-rwxr-xr-x 1 root root 10629 Mar 12 13:14 services.json

所以不是那样。

更新

Per @ Siguza的建议,我尝试添加另一个cookie来看看会发生什么。在第一次检查时,看起来在我解密之前运行dd( $request->cookies )时会发生一些非常奇怪的行为:

成功

ParameterBag {#40
  #parameters: array:9 [
    "PHPSESSID" => "k8qvmt8ccbhcqepbn7mib8kra6"
    "__unam" => "bc7c68-14f8d12a5ef-43097c02-217"
    "__utma" => "152883115.857409601.1438038184.1440976773.1441571912.15"
    "__utmb" => "152883115.4.9.1441572254693"
    "__utmc" => "152883115"
    "__utmz" => "152883115.1435960225.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
    "yetAnotherCookie" => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    "XSRF-TOKEN" => "eyJpdiI6ImVqcW1cL09cL3oyQ0ZIcFBiQTRmZXFKUT09IiwidmFsdWUiOiJEbzV0NHcraGNmd3BMb0hibG5uNm9UTnhvNlV4bVRCVWRHOWFBM3VrOG0wZ2Z2NmF5QnpuNFh6a1dYdmhcL2pmWUtIb2lsOGdBS29xV0hvNnFOQktxR2c9PSIsIm1hYyI6IjRjMjU4ZWYxMTJkZTQ1NTU2YWQ3M2EwZjAzZDQwNDI4YzNmOTJjYTVhZTUzZTg4MzFmNTUxZDFkMTljNDBjZjkifQ=="
    "laravel_session" => "eyJpdiI6IkRkcGNLRE9KK3hkOFRNdzFXQzQreWc9PSIsInZhbHVlIjoiQm1qN2lNa2pTQTE2ZTQxUzJxbExGYnhheFhjUkQwMEpybEQ3XC9cL0pDMzA1MXdEeHF3a09qbnRKTjdPMzRKdjdBeFFNQ1hkamw1THFQanlnUURoRjJndz09IiwibWFjIjoiYTkzNjdmYjYyYTMzODM2MmY2MjQyNzZhNDQ1YjY2NzQ3OTFiZjVjODIyZmYzYmE3YjhlNGM1ZjQ2NTk1MTczNyJ9"
  ]
}

失败

ParameterBag {#40
  #parameters: array:8 [
    "PHPSESSID" => "k8qvmt8ccbhcqepbn7mib8kra6"
    "__unam" => "bc7c68-14f8d12a5ef-43097c02-217"
    "__utma" => "152883115.857409601.1438038184.1440976773.1441571912.15"
    "__utmb" => "152883115.4.9.1441572254693"
    "__utmc" => "152883115"
    "__utmz" => "152883115.1435960225.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)"
    "XSRF-TOKEN" => "eyJpdiI6ImVqcW1cL09cL3oyQ0ZIcFBiQTRmZXFKUT09IiwidmFsdWUiOiJEbzV0NHcraGNmd3BMb0hibG5uNm9UTnhvNlV4bVRCVWRHOWFBM3VrOG0wZ2Z2NmF5QnpuNFh6a1dYdmhcL2pmWUtIb2lsOGdBS29xV0hvNnFOQktxR2c9PSIsIm1hYyI6IjRjMjU4ZWYxMTJkZTQ1NTU2YWQ3M2EwZjAzZDQwNDI4YzNmOTJjYTVhZTUzZTg4MzFmNTUxZDFkMTljNDBjZjkifQ=="
    "laravel_session" => "eyJpdiI6IkRkcGNLRE9KK3hkOFRNdzFXQzQreWc9PSIsInZhbHVlIjoiQm1qN2lNa2pTQTE2ZTQxUzJxbExGYnhheFhjUkQwM"
  ]
}

奇怪的是,我添加的新Cookie(还有另一个Cookie)完全消失了,而laravel会话仍然被截断。检查HTTP请求时,我注意到最后附加了yetAnotherCookie,因此截断整个字符串会合理地将其从列表中删除:

PHPSESSID=k8qvmt8ccbhcqepbn7mib8kra6; __unam=bc7c68-14f8d12a5ef-43097c02-217; __utma=152883115.857409601.1438038184.1440976773.1441571912.15; __utmb=152883115.4.9.1441572254693; __utmc=152883115; __utmz=152883115.1435960225.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); XSRF-TOKEN=eyJpdiI6ImVqcW1cL09cL3oyQ0ZIcFBiQTRmZXFKUT09IiwidmFsdWUiOiJEbzV0NHcraGNmd3BMb0hibG5uNm9UTnhvNlV4bVRCVWRHOWFBM3VrOG0wZ2Z2NmF5QnpuNFh6a1dYdmhcL2pmWUtIb2lsOGdBS29xV0hvNnFOQktxR2c9PSIsIm1hYyI6IjRjMjU4ZWYxMTJkZTQ1NTU2YWQ3M2EwZjAzZDQwNDI4YzNmOTJjYTVhZTUzZTg4MzFmNTUxZDFkMTljNDBjZjkifQ%3D%3D; laravel_session=eyJpdiI6IkRkcGNLRE9KK3hkOFRNdzFXQzQreWc9PSIsInZhbHVlIjoiQm1qN2lNa2pTQTE2ZTQxUzJxbExGYnhheFhjUkQwMEpybEQ3XC9cL0pDMzA1MXdEeHF3a09qbnRKTjdPMzRKdjdBeFFNQ1hkamw1THFQanlnUURoRjJndz09IiwibWFjIjoiYTkzNjdmYjYyYTMzODM2MmY2MjQyNzZhNDQ1YjY2NzQ3OTFiZjVjODIyZmYzYmE3YjhlNGM1ZjQ2NTk1MTczNyJ9; yetAnotherCookie=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

我清除了域名的所有Cookie并再次尝试:

成功

ParameterBag {#40
  #parameters: array:4 [
    "__unam" => "bc7c68-14f8d12a5ef-43097c02-217"
    "XSRF-TOKEN" => "eyJpdiI6ImV6aklvVVNwZHdCMThON1hQOW9rcmc9PSIsInZhbHVlIjoiWlY1aGdQamJ1Y2FQTGxTUDZTTmxPK2xLZm5xZG15enlVXC95RXhRMHNqbm9udkp5T3NnR3FBQ0dxRWEzYTdIVUFveHA1TTZkV2lTcGlcL1wvalQzQ09QbUE9PSIsIm1hYyI6IjYyMzM5MGM4MjYxNzYzNmI5NGYyZDFmMTU3M2M4NTA5NzBlYjZlMGZmMmViM2QzNjlhZjZmNTdlMmE4ZmRjMmUifQ=="
    "laravel_session" => "eyJpdiI6Illzd2xnalRXVzhKaVI0blRQUUtiNXc9PSIsInZhbHVlIjoiKzVaQVR0cHNqbDZEcGd5UG9POWFhbFdyYzhaTDNqb1FOQ2xmcEFYVUZUZTJkNUZSYzNRUlhCajJhNHBNK3VXd2gxYlwvUWtiTEE0bk5lVmp0d2lcL3pkQT09IiwibWFjIjoiNjA5MDU2ODViYTQ4YmM0YjlmYWVmOWY1NzliY2Y3YjdhYjMzYTA0MWU4ZjMwODg0N2E5NGI2N2U2ZDc3MTIwNSJ9"
    "yetAnotherCookie" => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  ]
}

失败

ParameterBag {#40
  #parameters: array:4 [
    "__unam" => "bc7c68-14f8d12a5ef-43097c02-217"
    "XSRF-TOKEN" => "eyJpdiI6ImV6aklvVVNwZHdCMThON1hQOW9rcmc9PSIsInZhbHVlIjoiWlY1aGdQamJ1Y2FQTGxTUDZTTmxPK2xLZm5xZG15enlVXC95RXhRMHNqbm9udkp5T3NnR3FBQ0dxRWEzYTdIVUFveHA1TTZkV2lTcGlcL1wvalQzQ09QbUE9PSIsIm1hYyI6IjYyMzM5MGM4MjYxNzYzNmI5NGYyZDFmMTU3M2M4NTA5NzBlYjZlMGZmMmViM2QzNjlhZjZmNTdlMmE4ZmRjMmUifQ=="
    "laravel_session" => "eyJpdiI6Illzd2xnalRXVzhKaVI0blRQUUtiNXc9PSIsInZhbHVlIjoiKzVaQVR0cHNqbDZEcGd5UG9POWFhbFdyYzhaTDNqb1FOQ2xmcEFYVUZUZTJkNUZSYzNRUlhCajJhNHBNK3VXd2gxYlwvUWtiTEE0bk5lVmp0d2lcL3pkQT09IiwibWFjIjoiNjA5MDU2ODViYTQ4YmM0YjlmYWVmOWY1NzliY2Y3YjdhYjMzYTA0MWU4ZjMwODg0N2E5NGI2N2U2ZDc3MTIwNSJ9"
    "yetAnotherCookie" => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK"
  ]
}

这次只截断了yetAnotherCookie,而不是laravel_session。再次查看HTTP请求,尽管首先设置了这个cookie,但是这个cookie再次进入列表的末尾(我猜Chrome是按字母顺序排列的Cookie列表?)只是现在整个列表更短了:

__unam=bc7c68-14f8d12a5ef-43097c02-217; XSRF-TOKEN=eyJpdiI6ImV6aklvVVNwZHdCMThON1hQOW9rcmc9PSIsInZhbHVlIjoiWlY1aGdQamJ1Y2FQTGxTUDZTTmxPK2xLZm5xZG15enlVXC95RXhRMHNqbm9udkp5T3NnR3FBQ0dxRWEzYTdIVUFveHA1TTZkV2lTcGlcL1wvalQzQ09QbUE9PSIsIm1hYyI6IjYyMzM5MGM4MjYxNzYzNmI5NGYyZDFmMTU3M2M4NTA5NzBlYjZlMGZmMmViM2QzNjlhZjZmNTdlMmE4ZmRjMmUifQ%3D%3D; laravel_session=eyJpdiI6Illzd2xnalRXVzhKaVI0blRQUUtiNXc9PSIsInZhbHVlIjoiKzVaQVR0cHNqbDZEcGd5UG9POWFhbFdyYzhaTDNqb1FOQ2xmcEFYVUZUZTJkNUZSYzNRUlhCajJhNHBNK3VXd2gxYlwvUWtiTEE0bk5lVmp0d2lcL3pkQT09IiwibWFjIjoiNjA5MDU2ODViYTQ4YmM0YjlmYWVmOWY1NzliY2Y3YjdhYjMzYTA0MWU4ZjMwODg0N2E5NGI2N2U2ZDc3MTIwNSJ9; yetAnotherCookie=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

这次切断了685字节,而不是之前的678。 Curiouser和curiouser。

更新2

这是另一个奇怪的。我尝试点击略微不同的端点。我点了www.mywebsite.com/api/employees/1

而不是www.mywebsite.com/api/employees/10

这次从cookie字符串中删除了一封额外的字母。这促使我再看一遍整个原始HTTP请求。原始HTTP请求中恰好有1435个字节是cookie字符串被切断的时候。

所以我又做了一个实验:我使用浏览器中的以下javascript发送了一个巨大的自定义标题

$.ajax('/api/employees/1', {
method: 'PATCH',
headers: {'X-REALLY-LONG-HEADER': 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'},
success: function(data) { console.log(data); }
});

我还稍微修改了返回值,因为Laravel的dd()函数将返回值包装在很多HTML中,这使得在控制台中难以解释。有了很长的标题,我在几次尝试后得到了以下内容:

Cookies:
__unam = bc7c68-14f8d12a5ef-43097c02-217
XSRF-TOKEN = eyJpdiI6ImV6aklvVVNwZHdCMThON1hQOW9rcmc9PSIsInZhbHVlIjoiWlY1aGd

这实际上是 1460 字节进入原始请求...我不确定如何解释它表现不同的事实,但这表明一些奇怪的1450字节限制在PHP的内置服务器在HTTP请求中崩溃之前。

更新3

尝试将PHP升级到5.6

首先让我失败了。 apt-get install --only-upgrade php5刚刚安装了一个稍新的5.5.9

然后我从php.net下载了源代码并尝试从源代码构建。根据{{​​1}}说明,您应该在运行INSTALL./configure之前运行make,所以我试了一下。过了一会儿,我得到了以下内容:

make install

我尝试使用... checking for strftime... (cached) yes checking which regex library to use... php checking whether to enable LIBXML support... yes checking libxml2 install dir... no checking for xml2-config path... configure: error: xml2-config not found. Please check your libxml2 installation. 更新此内容并获得以下内容:

apt-get install libxml2

由于root@C9-workspace:~/php-5.6.13# apt-get install libxml2 Reading package lists... Done Building dependency tree Reading state information... Done libxml2 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 200 not upgraded. 使我失败而我无法升级libxml2,我尝试了安装:

./configure

我可能只是作为服务器管理员不称职,但我不知道如何在没有有用的MSI文件的情况下安装PHP 5.6

0 个答案:

没有答案