0

I have created a plugin with a form to send a post request to a custom PHP file, but when I send the form, I get a 500 error.

To verify and ascertain that the error is not originating from my code I've created a simple HTML file with the same code and run a counter-test on it, to accessing through a GET request: I got no error (HTTP 500 error); I was able to access it successfully.

But: when I change the file extension from .html to .php, I get the same 500 error.

I have tried changing file permissions to 777.

Below is the HTML form of the plugin I'm developing (which gives me a 500 error):

<form action="http://example.com/wp-content/plugins/plugin-folder/form_processing.php" method="post">
    <!-- form content here -->
</form>

Here, content of another simple HTML file:

<html>
    <head>
    </head>
    <body>
        <!-- something -->
    </body>
</html>

When I change the file extension from .html to .php, it gives 500 error resulting from the GET request and I can't seem to determine the cause.

How can I solve this problem?

closed as off-topic by Pat J, Dave Romsey, cjbj, bueltge, jgraup Nov 17 '16 at 3:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – Pat J, Dave Romsey, cjbj, bueltge, jgraup
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Please edit your question, and add debug information. – fuxia Nov 14 '16 at 2:52
  • You shouldn't be using a standalone file as a form processor, you can use the same URL your form lives at to process the submission – Tom J Nowell Nov 14 '16 at 3:43
3

The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the web site's server.

You have to enable the debug true to understand what is the problem.

Open the wp-config.php file. To enable debugging mode, change define('WP_DEBUG', false); line to the define('WP_DEBUG', true); in wp-config.php file. Then you can find the what is the error.

  • 1
    Thanks! that worked. I can see the errors now. I had to turn on another properties such as display_errors. – gab06 Nov 14 '16 at 3:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.