Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

go's avatar
Level 2

504 timeout on form submissions through Wordpress on Laravel Forge server

Hi,

This is a bit of a strange question but I'm at my wits end. I have a Laravel Forge server with Wordpress installed, and everything works great. However, I have tested multiple form plugins and none of them actually submit the form as they should. They just spin endlessly.

I have installed these plugins on shared servers before, and also worth noting - I have disabled every other plugin and theme in order to determine this is not a plugin/theme conflict.

The error is:

504 Gateway Time-out

nginx/1.11.9

Edit: the data is apparently storing in the database, so maybe this is some kind of email sending error?

0 likes
2 replies
go's avatar
go
OP
Best Answer
Level 2

This problem was related to email sending and the server not being able to send emails.

There are free Wordpress plugins for external transactional email services, such as SparkPost. Once this was properly set up, everything worked as intended.

1 like
stuartcusack's avatar

Hey, I was receiving 504 timeout errors from various WordPress plugins and I had no idea what was happening. The error logs were not very helpful and forge support seem to be busy these days.

You are correct though, it turns out that the problem was caused by not having a mail command available on the default Ubuntu forge configuration. So thank you for pointing me in the right direction!

**This may not be an issue in newer forge installations. Sendmail seems to be installed by default on my latest forge server. You can check for sendmail with this command: apt list --installed or you can try to send a test email - see last point in my steps.

Anyway I fixed it by SSH'ing to the server and installing the sendmail package, like so:

First, set up a valid hostname if you don't already have one:

  • Change your server's hostname to ensure a qualified domain name is in place, otherwise sendmail config will fail. You need to do this in two places:
sudo vi /etc/hostname
 
sudo vi /etc/hosts
  • Restart Ubuntu:
sudo reboot

Install sendmail:

  • Run:
sudo apt-get install sendmail
  • Run sendmail config and answer 'Y' to all:
sudo sendmailconfig

To fix the TLS warning:

  • Edit sendmail config:
sudo vi /etc/mail/sendmail.mc
  • Add this line to the bottom:
include(`/etc/mail/tls/starttls.m4')dnl
  • Run sendmail config again and answer 'Y' to all:
sudo sendmailconfig

To send a test email:

  • Run:
echo "Subject: Does it work?" | sendmail [email protected]

Note that the test mail will probably go into your spam folder.

Please or to participate in this conversation.