View Full Version : fmencoder error on shared secure page

03-May-2007, 12:26 PM
I have fmencoder working perfectly from a normal page on the web server. When I run it from a "shared secure page" on the server, I get an error:
The following error occurred in FormMail :
Error=Filter "encode" failed (status 1):

(User data suppressed for security purposes. )

Referring form was https://protected.hostcentric.com/membrass/NRGHsite/Reservations.html (https://protected.hostcentric.com/membrass/NRGHsite/Reservations.html)
I have tried many configurations using sslencode which returned many different error messages, but I am now at a loss how to proceed. The site is: www.northridgeguesthouse.com (http://www.northridgeguesthouse.com).

NOTE1: I have the NRGH site running via an edited .htaccess file; please take a look at this file.
NOTE2: I have copies of phpinfo.php and testexec.php on the root of the site (www.memorialbrass.com (http://www.memorialbrass.com)) for diagnostic purposes.

Can anyone help?

03-May-2007, 09:37 PM

Does "encode" have $REAL_DOCUMENT_ROOT in it's setting?

If so, that's the problem. FormMail deduces the value based on what PHP reports. When you switch to the special HTTPS URL, the paths generally change.

If you know the true file system path to your fmencoder, then put the document root part of the path in SET_REAL_DOCUMENT_ROOT, and you should be fine from there.

If you don't know the true file system path, then you need to figure that out first.

http://www.memorialbrass.com/phpinfo.php reports the DOCUMENT_ROOT as being "/home/users/web/b511/hoc.membrass", so start with that.

If that doesn't fix it then I'll need to do some tests on your server.

03-May-2007, 09:53 PM
Do you mean in formmail.php? Here is the $FILTERS entry:
$FILTERS = array("encode"=>"/home/users/web/b511/hoc.membrass/NRGHsite/cgi-bin/fmencoder -k/home/users/web/b511/hoc.membrass/NRGHsite/cgi-bin/pubkey.txt", "null"=>"null");

03-May-2007, 11:29 PM

OK, that seems good.

So you're saying that it works with HTTP but not with HTTPS, correct?

03-May-2007, 11:42 PM
Yes. It worked perfectly before I changed the Reservations page from http to https.

04-May-2007, 07:34 AM

OK, I guess I'll have to diagnose the problem with your server.

Please send access details using this secure form:

06-May-2007, 05:25 AM

Your server intractible!

Firstly, it doesn't work with HTTP at all. The encoder does not get executed. No error message.

Also, instead of runniing the CGI application it tries to download it:

When I tried to configure to use httpencode, your server complains about not allowing the POST method.

Please contact your hosting provider and ask them to get the above URL to work.

Also, ask them to allow POST method to your cgi-bin.

We might then be able to make progress.

06-May-2007, 05:59 PM

Can you tell me what the response to that URL should look like in the browser? What is the response from fmencoder?

06-May-2007, 07:00 PM
I did some more reading in my client's host account control panel. The help section includes the statement: "CGI Languages supported: Perl and Python." I have posted an inquiry in their support section.

Jeff Duncan

06-May-2007, 09:09 PM

OK, when it works you'll see this message:

GET method not yet implementedThat doesn't mean the POST method will be allowed, but that's a start at least.

07-May-2007, 12:23 AM
fmencoder looks like a binary file, but php files are ascii. What exactly is the fmencoder file? What should the server os expect to open

07-May-2007, 01:10 AM

Correct, fmencoder is a binary program like 99.9% of the software installed on the server.

It should simply be executed like any program on the server. Scripts written in Perl, PHP or Python are executed by running a binary program that interprets the script.

FMEncoder obeys CGI conventions, so as far as the webserver (Apache) is concerned, it's just a CGI program.

20-May-2007, 09:38 PM
OK, I found that the hosting provider does not support compiled CGIs. So, I moved the client's site to a provider that does support them.

Now when I submit my form I get the following email response (note that there is no encoded attachment):

MIME-Version: 1.0 (produced by FormMail 7.14 from www.tectite.com (https://webmailcluster.perfora.net/xml/webmail/mailContent;jsessionid=33C5F1899EA84A07BAE7843CFCE65EC3.TC137a#))
Content-Type: multipart/mixed; boundary="PARTc1aa3b42abf9d2b3367cf6793d32c7a1"
Message-Id: <20070520212453.99DBEA004B@shaman.safesecureweb.com (https://webmailcluster.perfora.net/xml/webmail/mailDetail;jsessionid=33C5F1899EA84A07BAE7843CFCE65EC3.TC137a?__frame=_top&__lf=AdresseUebernehmenFlow&__sendingdata=1&resyncFolder.Doit=true&resyncFolder.TreeID=leftNaviTree&createMail.Action=create&createMail.To=20070520212453.99DBEA004B%40shaman.safesecureweb.com&__jumptopage=mailNew&__CMD[mailDetail]:SELWRP=resyncFolder&__CMD[mailDetail]:SELWRP=createMail)>
Date: Sun, 20 May 2007 17:24:53 -0400 (EDT)

(Your mail reader should not show this text.
If it does you may need to upgrade to more modern software.)

Content-Type: text/plain; charset=ISO-8859-1

North Ridge Guest House Reservation Request

Joe Tester
123 Main St.
Anytown NY, 12345
joe@host.com (https://webmailcluster.perfora.net/xml/webmail/mailDetail;jsessionid=33C5F1899EA84A07BAE7843CFCE65EC3.TC137a?__frame=_top&__lf=AdresseUebernehmenFlow&__sendingdata=1&resyncFolder.Doit=true&resyncFolder.TreeID=leftNaviTree&createMail.Action=create&createMail.To=joe%40host.com&__jumptopage=mailNew&__CMD[mailDetail]:SELWRP=resyncFolder&__CMD[mailDetail]:SELWRP=createMail)

Would like to reserve a 1 night stay beginning on May 22, 2008 for 2 guests.

Comments: This is a test.

Card type: VISA (encrypted card information attached)

Please send a confirmation of dates and prices.
Content-Type: text/plain; name="data.fmencoded"; charset=ISO-8859-1
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="data.fmencoded"


HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

I ran "phpinfo.php" and I notice that the server is running PHP5; does this matter?


20-May-2007, 10:37 PM

The bottom part is the encoded attachment.

It seems your email reader doesn't understand attachments, which is unlikely.

The format of the above looks fine, but perhaps your mail server has done something to it that doesn't appear in your above copy.

Step 1: send yourself an attachment an prove your email client works with attachments
Step 2: review the settings HEAD_CRLF and BODY_LF in FormMail - these are available to workaround faulty mail servers.

If you still can't get it to work, please add "supportstaff AT tectite DOT com" to the recipients of the email (and TARGET_EMAIL) and submit your form. I can then see the source of the email and advise further.

21-May-2007, 11:26 AM
I get email with attachments all the time.

I have added the supportstaff address to FormMail on 2 different servers: One is my own account and one is my client's new account. I then filled out the form on each site and submitted.

As you can see, the result is a perfect email with attachment from my account, and an imperfect email with embedded data and no attachment from my client's account. Other than host server "full paths" the configurations are identical. The form page on my account runs as a normal http page, but on my client's account it runs as a "shared https" page.

Where do I go from here?

21-May-2007, 08:40 PM

Thanks, I got them.

Yes, it is as you described and it's because your "faulty mail server" is adding extra blank lines to the email that it shouldn't be doing. It doesn't obey the relevant email Internet standards.

I can see (and you probably can too) that in the text at the top of the email lots of extra blank lines.

Instead of:

Joe Tester
123 Main St.
Anytown NY, 12345

we have:

Joe Tester

123 Main St.

Anytown NY, 12345


Unfortunately, this is quite common. :(

To workaround this, set HEAD_CRLF and BODY_LF as follows:


21-May-2007, 11:58 PM
Thank you, Russell. That solved the problem!

Hopefully I will be capable of completing my next installation without troubling you.