Contact Form 7 cause HTTP 500 error
Asked Answered
L

7

11

No one is able to submit forms, I took a look at it and I’m getting a POST 500 Internal Server Error.

POST http://carlsbad4rent.com/wp-json/contact-form-7/v1/contact-forms/321/feedback 500 (Internal Server Error)

enter image description here

Note: The same code is working well in localhost[wamp]

Lyse answered 28/11, 2017 at 10:29 Comment(4)
.htaccess file checked RewriteRuleZamora
Check your .htaccess for RewriteRule , Goto your ` cpanel-> File Manager, Click view -> show hidden(.dot files)`.Smother
In the inspector, as pictured in your screencap, click the network tab, then click the "xhr" button on the dialog that comes up, and submit your form again. You'll see the ajax call for the form submission show up in the list. Click that, then click "response" and it will show you the error from the server if you have errors enabled visibly.Indiscernible
In my case, the contact redirect plugin was for Contact Form 7 version 5+. Needed to update the Contact Form 7 plugin to the latest version. Also update Wordpress to get the latest version of the plugin.Leandraleandre
M
7

You need change in .htaccess file and in local setup folder name set as "wordpress" but in live site we have to change this name.

Before

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /agilitycards/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agilitycards/index.php [L]
</IfModule>

# END WordPress

You need to replace with below code in .htaccess file.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Medardas answered 28/11, 2017 at 11:3 Comment(0)
B
3

I had a similar problem, it turned out that the error was being caused by ModSecurity installed on the cpanel. Disabling ModSecurity did the trick for me. In my research, I came across similar problems that were caused by security modules on their servers like this case that was caused by All in One Security and Firewall.

Beckybecloud answered 25/6, 2019 at 20:17 Comment(0)
O
2

I had a problem with the "Contact Form DB" plugin. When I uninstalled the plugin contact form started working fine.

Uninstall any plugin which is associated with contact form 7 and test the contact form.

Overhead answered 10/7, 2024 at 15:58 Comment(1)
Turns out I had the same problem. Saved my day!Ashlar
M
0

I had this same problem - turned out it was related to the Polylang plugin I was using, in particular how I was registering strings to be translated.

A quick way to test is to disable your theme / enable the default theme and if Contact Form works, it's most likely to be a problem in the theme Functions file.

For me, the fix was setting the Polylang translations in functions.php like so:

if (function_exists("pll_register_string")) {
    pll_register_string( 'name', 'Translated string' );
}
Miyokomizar answered 8/3, 2018 at 12:1 Comment(0)
S
0

Had a 500 Status Code as well when submitting my Contact Form 7. Somehow the file "class-phpmailer.php" in "wp-includes" had a filepermission of "0". I have no idea why. But i fixed this issue by changing the files permission to 0644 and now my Contact Form 7 works well, again.

Slipon answered 26/1, 2019 at 10:13 Comment(0)
S
0

I had the same Error and despite all the fixes proposed above none worked.

I had to downgrade fromm PHP 8.0 to 7.4

This is now working well

Sapro answered 7/10, 2023 at 6:45 Comment(0)
G
0

For me it was because I had [_date] in my php code. The code worked well until recently. Changed it to [date] and it started working again.

Gemmule answered 25/2, 2024 at 15:11 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Streetwalker

© 2022 - 2025 — McMap. All rights reserved.