I am establishing a brand new web server, and there is a small problem.

Whenever I use an easy publish form (ie):

<form method="POST" action="http://IP/comments.php">

<p><label>Email: </label>
<input type="text" name="login_email" />

<input type="submit" value="Login" />


The browser redirects to my remote address rather than comments.php. What's the problem here?


<?php echo "This is an empty page"; ?>

Observe that when the target is definitely an html file, the shape executes. Therefore the problem seems to become delivering publish data to some PHP file

what about doing something similar to this

<form method="POST" action="comments.php">

Your webserver returns error code 301 when POSTing to comments.php (see below). This isn't a PHP problem, but most likely a configuration error. You can examine your virtual host configuration files or any .htaccess files that may live in your directory under consideration.

$ netcat 80      
POST /comments.php HTTP/1.1
Content-Length: 1

HTTP/1.1 301 Moved Permanently
Date: Tue, 10 Jan 2012 03:18:28 GMT
Server: Apache/2.2.21 (Amazon)
Content-Length: 228
Connection: close
Content-Type: text/html; charset=iso-8859-1

<title>301 Moved Permanently</title>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="$">here</a>.</p>