You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress表单插件Ajax请求504网关超时问题求助

Troubleshooting 504 Gateway Time-out on Form Submissions (Contact Form 7, WPForms, Ninja Forms)

Hey there, let’s tackle this tricky 504 timeout issue you’re hitting with all three form plugins. It’s odd that emails go through successfully but the Ajax request hangs until it times out—this usually means the backend completes the email send but gets stuck somewhere before it can send a success response back to the frontend. Since you’ve already tweaked nginx and php-fpm settings, let’s dig into other likely culprits:

  • Email delivery is blocking the Ajax request
    Most WordPress form plugins run email sends synchronously during the Ajax call. If your email server (Sendmail, Postfix, or a third-party SMTP service) is slow to process or acknowledge the send, it can cause the PHP script to hang until it hits the timeout limit. Try switching to an SMTP plugin to handle email delivery asynchronously, or check if your hosting provider has email delivery delays. Also, verify if your email service requires extra authentication steps that are causing a lag.

  • PHP process gets stuck on post-email tasks
    After sending the email, plugins often run additional actions like saving form entries, triggering webhooks, or executing custom code via hooks. If one of these actions fails or takes too long, it’ll block the response. Try:

    • Disabling any custom code snippets related to form submissions (check your theme’s functions.php or custom plugins).
    • Turning off post-submission features in each form plugin (entry saving, webhooks, redirects) to see if the timeout disappears.
    • Testing database performance—run a quick insert query in phpMyAdmin to see if saving form entries is slower than usual.
  • Hidden server resource limits beyond nginx/php-fpm
    Even if you adjusted nginx’s proxy_read_timeout and php-fpm’s max_execution_time, there might be other limits overriding your settings:

    • Check your hosting provider’s global PHP limits by creating a phpinfo.php file with <?php phpinfo(); ?> and verifying values like max_execution_time, memory_limit, and max_input_time (some hosts force their own values).
    • Look into server-level timeouts, like Apache’s Timeout setting (if using Apache behind nginx) or cloud load balancer timeouts (AWS, GCP, etc.)—these can override your nginx configurations.
  • Plugin or theme conflicts (even across all three form tools)
    Just because all three plugins are affected doesn’t rule out a common conflicting plugin or theme. Try:

    • Switching to a default WordPress theme (like Twenty Twenty-Four) temporarily to rule out theme-related issues.
    • Disabling non-form plugins one by one, testing the form after each disable, to spot the conflicting tool.
  • Enable detailed logging to pinpoint the hang
    Without logs, it’s hard to know exactly where the process gets stuck. Enable:

    • PHP error logging: Set log_errors = On and error_log = /path/to/php-error.log in your php.ini, then check the log after triggering the timeout.
    • nginx error logs: Look in /var/log/nginx/error.log for entries related to timeouts or proxy errors.
    • Form plugin logs: All three tools have built-in logging (CF7 has debug mode, WPForms logs under Settings > Tools, Ninja Forms logs in Advanced Settings). Enable these to see if the plugin reports errors after sending the email.
  • Test asynchronous form submission
    If possible, configure the plugins to handle submissions asynchronously. Some offer this via add-ons or settings—for example, CF7 has async options, and WPForms can use background processing for email sends. This way, the Ajax call returns immediately, and email/entry processing happens in the background.

Hopefully one of these steps helps you track down the root cause. It’s likely a slow process hanging the PHP script after the email is sent, so focusing on post-submission tasks or email delivery latency should lead you to a fix.

内容的提问来源于stack exchange,提问作者Leavlzi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:04:35