LoginSignup
2
0

More than 5 years have passed since last update.

post_max_sizeの値の設定ミスで$_POSTが空に

Posted at

現象

設定を色々いじっていたら、WordPressのログインフォームに何を入力してログインしてもまたログインページに戻されるだけで、ログインすることができなくなった。

試しに以下のtest.phpをサーバに設置してcurlでリクエストを送ってみたところ、以下のログのように$_POSTに何も入っていないことがわかった。

test.php
<?php
print_r($_POST);
curlのログ
$ curl -v -F a=b http://192.168.0.12:8080/test.php
*   Trying 192.168.0.12...
* TCP_NODELAY set
* Connected to 192.168.0.12 (192.168.0.12) port 8080 (#0)
> POST /test.php HTTP/1.1
> Host: 192.168.0.12:8080
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 137
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------8fead5c0cbafb9b2
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Mon, 25 Sep 2017 14:19:12 GMT
< Server: Apache/2.4.10 (Debian)
< X-Powered-By: PHP/7.1.9
< Content-Length: 10
< Content-Type: text/html; charset=UTF-8
<
Array
(
)
* Connection #0 to host 192.168.0.12 left intact

原因

今回の場合、php.iniでpost_max_size=20Mと書くべきところにpost_max_size=20MBとBを付けていたことが原因でした。以上です。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0