1

I am currently learning PHP and I've decided to switch to the JetBrains PhpStorm from my regular editor + WAMP configuration and after copy-pasting few examples I did earlier I have found that its inbuilt server is not behaving properly (for me at least).

Currently I have a project setup with two files:

index.html:

<html>
<body>

<form action="welcome.php" method="post">
    Name: <input type="text" name="name"><br>
    E-mail: <input type="text" name="email"><br>
    <input type="submit">
</form>

</body>
</html>

welcome.php:

<html>
<body>

Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>

</body>
</html>

This is a basic PHP Forms example from W3schools that works as expected on my WAMP configuration, but when I run it with PhpStorm after inputing email and name I get the following output on welcome.php:

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
Welcome
Notice: Undefined index: name in D:\deve\PhpstormProjects\untitled\welcome.php on line 4

Your email address is:
Notice: Undefined index: email in D:\deve\PhpstormProjects\untitled\welcome.php on line 5

The ..$HTTP_RAW.. and ...Cannot modify header information... warnings show up no matter what php script is running on the welcome.php but only with the PHP 5.6 while the same warnings are absent when I am using PHP 7.0 interpreter.

The ..Undefined index.. error shows up only when I am using the post method.

I've tried:

  • reinstalling
  • trying few different PHP Versions: PHP 7.0 (solves the first pair of errors), 5.6.20 and 5.6.16 both x86 and x64
  • setting always_populate_raw_post_data to different values including -1 made no difference

Again it's worth mentioning that I had no problems on WAMP. I am using PHP 5.6.16 there. Any help is appreciated in getting this thing to work as intended!

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Smiki
  • 19
  • 5
  • 2
    Use proper web server (Apache from your WAMP/XAMPP .. or just IIS) -- the PhpStorm's built-in web server at the moment has some issues with POST requests (see http://stackoverflow.com/a/34787827/783119 ). Not sure about error messages though. – LazyOne Apr 26 '16 at 21:53
  • I would recommend you to install some linux server and develop on it since if you are doing with php and you think it seious you have to sooner or later learn linux. It will be definetaly less bugy – Autor69 Apr 26 '16 at 22:02
  • @LazyOne Yea i switched to WAMP's Apache everything's ok now thanks. – Smiki Apr 26 '16 at 22:22
  • I am guessing you have solved this issue.But for anyone else I hope this helps https://laracasts.com/discuss/channels/laravel/set-always-populate-raw-post-data-1-to-laravel-php-ini – Haseeb Jan 16 '17 at 05:31

0 Answers0