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!