Contact Form and PHP Conflict

Hello. I am basically having the same problem you all already fixed for me years ago when I wrote about PHP no longer being supported.

I just upgraded to RW 8, in addition to my host (Little Oak) telling me my PHP would no longer be supported in Dec. I tried all the other PHP options in the drop down (7.4 and 8.0, currently, 7.3) but still getting the php code showing up in my contact form .

I also looked to see if there was an .html version on the sever, but did not see one.

I’m sure the problem is simple, but just outside of my reach/understanding. Can anyone guide me on where I am going wrong on my contact page?
Screen Shot 2021-11-12 at 10.40.12 AM|552x187

Do you have any redirects on this site? Perhaps an htaccess file, any thing?

Here’s what I can tell you. You have a file called:
It’s looks to be the same one that gets served when you enter the contact form URL(tidy linked):
When I look for the php version (with the full URL): I get redirected (with a 302) to the home page of the site.

It looks like you have set up an ErrorDocument 404 redirecting all not Founds to the home page. That’s really not a good user experience, as folks won’t know they have an error.

That aside, you have no php version on the server. The html version on your server is a php file. You need to delete the html version. You aren’t looking at the correct directory if you didn’t find one. And publish the php version. You could also just rename the version you have to index.php instead of index.html.

Look for a directory called contact/ from the root directory (If I remember, little oak uses www/). You can use the file manager or an FTP app like transmit or FileZilla. You will find an index.html file in that directory. Either delete it or rename it.

1 Like

Thank you. I did find the file and delete it - although I thought I already had before I posted. Nothing changed when I republished the page. I republished all pages and then the PHP code disappeared from the display on the web site. But you are right, when I fill out the form, I never get the test email, and as a user, I would not know there was an error. Thank you for pointing that out.

I don’t remember setting up an Error/redirect, but clearly I did at one point. Is that also related to my contact form not working properly? I will try and work through your suggestion of clearing the Error.

I am using Plus Kit to import my contact page into another page. To make things work could I just forget all of that and use the standard concat page from RW? Thank you again. I don’t know a lot about the behind the scenes of all of this, but trying to learn.

No, that should have no impact on the form working or not working. There is nothing wrong with (and in fact it’s a good thing) to use the ErrorDocument 404 to redirect not founds. You just need to create a custom 404 page that lets the user know that the page isn’t found. For best user experience, make sure the 404 page has navigation and a clear link to the home page is fine. Some folks get really “cute” by trying to be funny with 404 pages and forget that the user is lost and needs help to find what they are looking for.

Why the contact form isn’t working is hard to say. Contact forms have gotten more difficult to set up as many hosting companies are cracking down on sending mail from websites. It’s not the hosting company’s fault. Many devious folks are using web mail servers to send massive amounts of spam. Once a hosting company’s mail servers get tagged as a spammer, then legitimate emails get blocked.

The built-in contact form that comes with RW is pretty simple. Using PlusKit should work okay if the contact form itself can work. I’ve honestly never have used this form though. For a simple form like you’re using, you might have a look at @Doobox’s HTML Contact Stack. It’s not very expensive and is pretty easy to set up.

If you think you need a more complicated form to define fields, there are several options like FormLoom, Formsnap and Superform 2. These offer a lot more options if you wanted to get more information from the perspective customer.

The problem with debugging contact forms is that PHP errors don’t get sent to the browser. In fact, errors often by default don’t even get logged. In most shared hosting settings, you don’t have access to the php.ini file to turn error logging on and off.

So whatever form you want to use, you’ll probably need to check with Little Oak and find out what requirements they may have to email contact form. You also might need to have them help you debug what is happening when you send the mail with php errors.

Btw: while you are checking with them, I’d find out about getting an SSL certificate so you can get rid of that “Not Secure” warning. Any good hosting company is making them available for free.

Thank you! I will keep at it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.