PDA

View Full Version : Encoder



danp
27-Apr-2007, 09:51 PM
Forms work great until I add try to encode with <input type="hidden" name="filter" value="encode">. Then when I submit the form I get "Page cannot be displayed". No error messages and the form is not emailed to me and fmbadhandler does not work.

When I browse to fmencoder I get "GET method not yet implemented".
We are using PHP 4.4.1.
Safe mode is OFF.
OpenSSL support is enabled.
I've uploaded fmencoder for linux into cgi-bin folder using binary file transfer and set file mode to 711. Also tried 755. Is it supposed to be 711 or 755?
Uploaded public key file and set file mode to 644.
I also have changed the name of FormMail to fm.php.

Can't think of anymore details. What should I check or try next?

Thanks,
Dan

russellr
27-Apr-2007, 10:24 PM
Hi,


Forms work great until I add try to encode with <input type="hidden" name="filter" value="encode">. Then when I submit the form I get "Page cannot be displayed". No error messages and the form is not emailed to me and fmbadhandler does not work.

Something's gone awry with the server setup.



When I browse to fmencoder I get "GET method not yet implemented".

That's really good news, because fmencoder works on your server.



I've uploaded fmencoder for linux into cgi-bin folder using binary file transfer and set file mode to 711. Also tried 755. Is it supposed to be 711 or 755?

711 is fine, so is 755. Much the same as far as the program is concerned.



Uploaded public key file and set file mode to 644.

Perfect.



Can't think of anymore details. What should I check or try next?

We need to diagnose, or guess, what's gone wrong. The error you're getting means that the server is not executing the PHP script properly (or the PHP is dying for some reason).

The server logs will contain helpful information (apache? if so, there's an error log you should be able to find).

However, I'll take a couple of guesses.

Do you think you can figure out the how to create a directory/folder for temporary files and setup SCRATCH_PAD?

Here's the documentation: http://www.tectite.com/fmdoc/scratch_pad.php

Start with that, and then we'll work from there.

danp
27-Apr-2007, 11:41 PM
Thanks for the quick reply. I'll see if I can get that done and check on the log files and get back to you when it's done.

For what we are doing, is it necessary to create the directory above the doc root dir/folder?

Dan

russellr
27-Apr-2007, 11:58 PM
Hi,

It's generally better to create about the document root, alternatively you can protect from the web with .htaccess instructions.

But, the temporary files generally don't contain any sensitive information so it's not critical.

danp
30-Apr-2007, 09:44 PM
Good Morning and hope you enjoyed your weekend. We're 15 hours earlier here. 4:30pm, Monday.

I checked the error log. It shows the following error:
"script not found or unable to stat: /home/cgi-bin/fmencoder"

I have set up the SCRATCH_PAD folder. Hope I set the path correctly.

Does the error tell you what might be wrong? It sounds like formmail is not finding the file, since we know we can browse to it. I left $FILTER set to the default. ("encode"=>"REAL_DOCUMENT_ROOT/cgi-bin/fmencoder -kpubkey.txt", "null"=>"null")

Dan

russellr
30-Apr-2007, 10:04 PM
Hi,



I checked the error log. It shows the following error:
"script not found or unable to stat: /home/cgi-bin/fmencoder"

Excellent! That tells us exactly what the problem is.

$REAL_DOCUMENT_ROOT has the incorrect value of just "/home".

To fix this, you need to know to know the full path to your document root.

You probably know this if you've managed to set $SCRATCH_PAD correctly.

What you need to do is put the document root path in SET_REAL_DOCUMENT_ROOT (http://www.tectite.com/vbforums/../fmdoc/set_real_document_root.php) (click to review the documentation).

This script will help you find the document root (look for DOCUMENT_ROOT in the output):


<?php
phpinfo();
?>

danp
30-Apr-2007, 10:21 PM
php shows the "DOCUMENT_ROOT" as /usr/local/etc/httpd/htdocs

When I FTP into my files, the first place I come to is /
to get to cgi-bin I go to /www/cgi-bin

This is a little beyond me. So what do I want to use for the path in SET_REAL_DOCUMENT_ROOT?

russellr
30-Apr-2007, 10:46 PM
Hi,

FTP tells lies. Actually, it's just a security feature in FTP servers that locks you into a particular area. The directory path it tells you means nothing.

Do you have SSH or telnet access to the server?

If not, just ask your hosting provider what the full path is to your web servers document root.

They should have told you this when you signed up.

danp
30-Apr-2007, 10:57 PM
May have telnet, but never used it. It would be easier to ask tech support.
Thanks,
Dan

danp
01-May-2007, 07:27 PM
Tech support sent me this:
Here is the path to the file fmencoder, /usr/local/etc/httpd/cgi-bin.

Note: This cgi-bin is one level under my web files directory which is usr/local/etc/httpd/htdocs. This is same as phpinfo gives us for the document root.

/usr/local/etc/httpd/cgi-bin causes this error:
Error=Cannot chdir to "/usr/local/etc/httpd/cgi-bin/cgi-bin" to run filter "encode": No such file or directory (errno 2)

/usr/local/etc/httpd causes this error:
This page cannot be displayed. IE6.
In Foxfire it trys to open formmail in my web editing software.

???
Dan

russellr
02-May-2007, 03:08 AM
Hi,



Tech support sent me this:
Here is the path to the file fmencoder, /usr/local/etc/httpd/cgi-bin.


I have a strong suspicion that they are wrong.

Here's a script that should reveal the truth:


<?php
echo getcwd();
echo "<br />\n";
system("pwd");
?>


Please call it "pwd.php" and load it into your document root and also cgi-bin.

Open in a browser to find the truth paths.

danp
02-May-2007, 10:48 PM
When I browsed to pwd.php I got this:
/usr/local/etc/httpd/htdocs
/usr/local/etc/httpd/htdocs

This is the same as phpinfo has for the Document Root.This is where my web page files are located.

NOw, cgi-bin is on the same directory level as htdocs is. In other words, when I ftp in, I see both the htdocs directory and the cgi-bin directory and can open either one. Maybe this will help you understand the directory structure.

With /usr/local/etc/httpd/htdocs in $SET_DOCUMENT_ROOT and I submit the form it trys to open the file in my web editor in Firefox and says Page Cannot Be Displayed in IE6. I've tried several variations, but nothing works. I either get this error or Cannot chdir to "/usr/local/whatever" to run filter "encode".

Any other ideas?
Thanks,
Dan

russellr
02-May-2007, 11:57 PM
Hi,


When I browsed to pwd.php I got this:
/usr/local/etc/httpd/htdocs
/usr/local/etc/httpd/htdocs

This is the same as phpinfo has for the Document Root.This is where my web page files are located.

Yes, that's pretty conclusive now. It's a very surprising path, though.



With /usr/local/etc/httpd/htdocs in $SET_DOCUMENT_ROOT and I submit the form it trys to open the file in my web editor in Firefox and says Page Cannot Be Displayed in IE6. I've tried several variations, but nothing works. I either get this error or Cannot chdir to "/usr/local/whatever" to run filter "encode".


My next thought is that your webserver refuses to execute binary CGI programs.

So, the workaround we have for that is to use the SOCKET_FILTERS (http://www.tectite.com/fmdoc/socket_filters.php) configuration instead of FILTERS.

Replace "YourSiteHere" with your site name



$SOCKET_FILTERS = array(
"httpencode"=>array("site"=>"YourSiteHere",
"port"=>80,
<snipped>

and then in the HTML form replace "encode" with "httpencode".

If you need help with this setup, please send server access details using this secure form:
https://secure.rootsoftware.com/~tectite/sendsecret.php (https://secure.rootsoftware.com/%7Etectite/sendsecret.php)

danp
08-May-2007, 05:02 PM
Success. It works. Have just submitted my purchase order. Thanks for all the help.
Dan