PhPStorm 10 does not allow POST method

Hello,

I developed a PHP application using POST method in PHPStorm 9. The problem is when I upgraded today to use the new PhpStorm version but now, when I launch the application using the IDE, it is not allow me to use the POST method because it is not sending the data. I tried with PHP 5.6 and PHP 7 on Windows 10. The GET method works fine.

However, I have launched the same application using an Apache with PHP7 on Windows 10 and it is working.

Some suggestion?

Thank you.

9
31 comments
Avatar
Permanently deleted user

I have the same problem...and It started when I upgrade to PhpStorm 10.0.2.

I have been trying to fix it but without success.

The problem is that the variable $_POST doesn't contain anything, that is, is absolutely empty.

It is important to say that the problem only occurs when the application is launched from the IDE.

Below there is some test code as simple as possible...

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test</title>
</head>
<body>
<h1>Test</h1>

<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    var_dump($_POST);
}
?>

<form action="index.php" method="post">
    <input type="text" name="user">
    <input type="submit" value="Submit">
</form>

</body>
</html>


Output:

Test

array(0) { }

Setting a breakpoint on var_dump($_POST); the variables are shown as follow:

testCode.JPG

Thanks in advance to anyone who be able to bring some light over the issue.


Edit: I have installed the 10.0.0 version again and there is no problem, the results are the expected ones.

Test

array(1) { ["user"]=> string(4) "test" }



Message was edited by: publio

0

Hi there,

1) What sort of URLs do you use there?
2) How do you POST? A form on a page which you submitting or some other means (e.g. REST client etc)?

0
Avatar
Permanently deleted user

Hi!

1) The URLs looks like http://localhost:63342/{PROJECT_NAME}/index.php when I am testing locally.

2) The problem occurs even when there is a simple form inside a page like the example above.

0

URL tells that you are using PhpStorm's built in web server. Is that what you choose to use yourself .. or you wanted to use your actual Apache (or whatever web server you have got there)?

  • If you want to actually use built-in web server .. then I may suggest to submit new ticket at Issue Tracker -- I have not found any existing tickets in this regard (and this behavior seem like a bug in IDE).
  • If you want to use your proper web server (e.g. Apache) then please create and configure Deployment entry and mark it as Default for this project -- if no deployment specified (that's where IDE takes base URL from) PhpStorm will use built-in web server.
0
Avatar
Permanently deleted user

I was expecting to use the built-in web server option, so I will submit a ticket.

Thanks!

0
Avatar
Permanently deleted user

Thank you so much both.

Publio, have you published the ticket?

0
Avatar
Permanently deleted user

Sorry I'm a little busy right now. If you could do it I would appreciate you. If you do let me know to support you in the report.

0
Avatar
Permanently deleted user

Ok, don't worry. I posted it. I said that we discuss that theme in this post.

You can see the issue in: https://youtrack.jetbrains.com/issue/WI-30168

1
Avatar
Permanently deleted user

Hello, guys! I got exactly the same issue with $_POST and local server. I am working on Ubuntu.
Thanks for submitting a ticket. For now I am going to roll back on previous PphStorm version, which is working fine.

0
Avatar
Permanently deleted user

I found this problem only happened on 10.0.2, the earlier versions (like 10.0.1) works fine.

0
Avatar
Permanently deleted user

I can also confirm that POST parameters are not passed into $_POST global variable in version 10.0.3. In other words the PHP superglobal is empty:

phpstorm-post.png

The script is launched from browser with URL:  http://localhost:63342/LearningPHP/index.php. I can see from Firefox developer tools (network tab), that fname parameter was passed with its value and request method is POST indeed (so like in the XDebug as you can see on attached screenshot).

OTOH GET parameters are passed with no issues.

0
Avatar
Permanently deleted user

Confirming I am seeing this issue as well on Mac, PHPStorm 10.0.3 and while using the built-in web server.  POST does not work whatsoever, even in the simplest of cases.

Has anyone had any success in remedying the issue?

0
Avatar
Permanently deleted user

@Gary B

1) Use PHPStorm 10.0.1 (no issues with $_POST in this version)

2) Do not use PHPStorm in-built server

3) You can use php server instead e.g. "php -S localhost:8000"

0
Avatar
Permanently deleted user

I have the same problem.

I'am newbie in programming but can you still debug if not using phpstorm server?

0
Avatar
Permanently deleted user

Same Problem here. Both in PHPStorm 10.0.3 and Intellij IDEA 15.0.3.

Works fine when run in XAMPP.

0
Avatar
Permanently deleted user

I am a new PHPStorm user and found the issue with the POST while testing out the tool after spending quite a bit of time validating my installation and configuration.

Unfortunately I am unable to find a link to download PHPStorm 10.0.1 that was mentioned above as not having the issue.  I have only found download links for version 10.3 and versions <= 9.x:  https://confluence.jetbrains.com/display/PhpStorm/Previous+PhpStorm+Releases .   

POST is core functionality for many web applications.  I recommend increasing the priority of the issues to higher than the currently assigned priority of normal (https://youtrack.jetbrains.com/issue/WI-30168 mentioned above and the linked https://youtrack.jetbrains.com/issue/WEB-17317) .

 

0
Avatar
Permanently deleted user

I have the same problem too on my Ubuntu workstation...

POST method works correctly when I don't load directly form the IDE but if it runs from the IDE $_POST is empty and does not contain any values.

 

 

0
Avatar
Permanently deleted user

it is worrying that subject is still an issue by now for such IDE and company. Disappointing. I wrote about it a month ago.

0
Avatar
Permanently deleted user

This bit me hard yesterday. I'm brand new to php and phpstorm so I spent a lot more time on it than was probably reasonable, my fix was to use xampp. Once I figured out that phpstorm itself was the problem I was up and running in less than 20 minutes.

It _may_ be the case that most people use something like xampp (if not xampp itself) but it seems silly that a person _has_ to use xampp in order to use phpstorm for all but the simplest development task.

Edit: I'm using version 10.0.3 btw

0
Avatar
Permanently deleted user

I am having the same problem. I was using 10.0.3 and the $_POST was always empty. I just downloaded the new release of PHPStorm 2016.1 and the problem is still not resolved. I hope they fix this soon!

0

priority needs to be ^^^!

And, I confirm that phpStorm 2016.1 still has the issue.

$_POST is used by nearly every web application and for the jetbrains internal server to not support it is ludicrous.  Among other things, PHP frameworks like YII can not work without  $_POST.

 

 

 

0
Avatar
Permanently deleted user

Hi guys!

I just resubmitted the issue to the tracker, because I think the original one was not informative enough.

Here is the link: https://youtrack.jetbrains.com/issue/WI-31257 

Vote, share, like, comment, tell your friends!

0
Avatar
Permanently deleted user

Hi,

I also found this problem and tried to fix it for several hours (well, even days). I have phpStorm 2016.1 with PHP 7 and Windows based Apache 2.4. Please fix this issue.

 

 

0
Avatar
Permanently deleted user

Actually the only solution I know of that works for me is to submit the form to an absolute url

0
Avatar
Permanently deleted user

Absolutely blows my mind that this is still an issue.

Anyways, I worked around it with the following:

 

$_POST = array(); //workaround for broken PHPstorm
parse_str(file_get_contents('php://input'), $_POST);
3

Please fix this.  It's a problem for the Mac too.

0
Avatar
Permanently deleted user

Abdul Ghani life saver ;) I was sitting few days and cant get this right. 

There are still errors:

Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0

0
Avatar
Permanently deleted user

I use Xampp with PHPStorm and i resolved the problem.
I edited httpd.conf of Xampp and i replaced port 80 by PHPStorm's port on this lines:

Listen 63342
ServerName localhost:63342

And it works well for me :)

1
Avatar
Permanently deleted user

for people having problem processing form data using $_POST method, try out Quentin Oe solution, i had the same issue and i try his solution and it work for me. the solution is this: open xampp control panel, click confi on the row that has apache and then open Apache(httpd.conf) and change the port to listen to 63342 and the serverName localhost to 63342

1

Please sign in to leave a comment.