cancel
Showing results for 
Search instead for 
Did you mean: 

Hang up with running PHP script

AlanStirling
Newbie
Posts: 3
Registered: ‎22-12-2008

Hang up with running PHP script

Hi Folks ...
currently working on setting up my website and wish to use a feedback form that utilizes a small php script i obtained online. Problem is, having put the script in my cgi-bin and set the permissions to 755 when i go to my website and try a test send of my form i get the message: Not Found
The requested URL /FormToEmail.php was not found on this server.
I wonder whether the 'form action' code i'm using is defective and would appreciate if someone could give it the once over and let me know:

<form action="http://ccgi.ker001.plus.com/FormToEmail.php" method="post">
Alan
8 REPLIES 8
gswindale
Grafter
Posts: 942
Registered: ‎05-04-2007

Re: Hang up with running PHP script

what's the URL to the script itself?
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: Hang up with running PHP script

Shouldn't the action simply be
action="/cgi-bin/FormToEmail.php"
on the CCGI platform?
David
pjmarsh
Superuser
Superuser
Posts: 4,035
Thanks: 1,579
Fixes: 20
Registered: ‎06-04-2007

Re: Hang up with running PHP script

Does PHP work inside the cgi-bin directory?  I think you need to use PHP outside of there.
Phil
Edit: Yep, as I thought.  If you manipulate the url in the OP to include the cgi-bin directory you can see the PHP source code.

Superusers are not staff, but they do have a direct line of communication into the business in order to raise issues, concerns and feedback from the community.

AlanStirling
Newbie
Posts: 3
Registered: ‎22-12-2008

Re: Hang up with running PHP script

Hi ...
firstly thanks to you all for taking the trouble to post. Having made the best fist i can of understanding your comments (not really in my comfort zone with this stuff) here's an update: my action line in my page code now reads: <form action="http://ccgi.ker001.plus.com/FormToEmail.php" method="post">. Having moved the script up one level out of the cgi-bin folder, now, when i try to test the form i see a page basically showing the text of the php script ... as i also see if i enter the following in my browser: http://ccgi.ker001.plus.com/FormToEmail.php. An improvement i feel on an error message but still obviously not quite right?Huh
Alan
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: Hang up with running PHP script

The form worked OK for me using my webspace on PAYH (I don't have CCGI setup).
What I did is as follows:
Downloaded the FormToEmail.php source to a folder on my PC below my PAYH website httpdocs (for convenience)
Created a hack webpage HTML file in the same folder
Copied the Form code unchanged into my hack HTML file and saved it (step1)
Typed my email address in place of the dummy string (step2)
Made no other changes to FormToEmail.php, saved the file.
Uploaded the webpage and PHP file to the same folder on PAYH.
Loaded the hack webpage into IE7, and the form displayed.
Filled in the form and clicked Send
Got the Thank You acknowledgement of successful send.
Clicked the "continue" link and the display returned to my home page (the stated default).
The email created by the form arrived in my mailbox.
Note: I didn't make any change to the "action=" content of the form (or any other part of the form definition).
This is obviously a different installation from CCGI but does my narrative give you any clues?
David
David
AlanStirling
Newbie
Posts: 3
Registered: ‎22-12-2008

Re: Hang up with running PHP script

Hi David ...
with the script reverted to the default action line and located in my htdocs folder with my webpages, when i run a test form i get the following message: URL requested (/"FormToEmail.php") not found. The entry in the address bar at the top of my browser page reads: http://www.ker001.plus.com/"FormToEmail.php". All of which begs the question: why is the form not being found? I have no knowledge whatsoever of how HTML/Websites work but it strkes me if i apply basic logic that a script located in the same folder as the page that is trying to call it, shouldn't be that hard to find ... fun and games ...
Alan
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: Hang up with running PHP script

Hi Alan,
I suspect you might have &quot; escapes round the "action=" filename so that the filename looked for starts and ends with a "quote", but it doesn't and shouldn't.
However, there is one difference between your set-up and mine that I'd forgotten. Your HTML page is on homepages whereas the PHP script has to be on CCGI - in my case both were in the same PAYH webspace. This is why you had to change the "action=" line. Embarrassed
Having looked at a friend's HTML code that works and references a CCGI PHP file from HTML homepages (though not through a form), the PHP call-up is http://ccgi.domainname/subdir/filename.php which apart from use of a sub-directory is similar to the format you had for the action in your opening post. However at the time I think you had the file in the /cgi-bin folder so it wasn't found. Phil mentioned PHP files wouldn't work in /cgi-bin so you tried moving it up a level when it was found but not interpreted. Speculating it's possible that the interpretation problem also extends to the level above.
I suggest you try putting FormToEmail.php in a CCGI subdirectory of your choice then reference it via action="http://ccgi.your-domain/your-subdir/FormToEmail.php"? You might want to change "/" in the FormToEmail.php $continue = "/"; line to "http:/www.your-domain/" so that it returns to your homepages HTML file rather than the top level on CCGI.
David
David
Peter_Vaughan
Grafter
Posts: 14,469
Registered: ‎30-07-2007

Re: Hang up with running PHP script

Also remember filenames and directory names are case sensitive so ForntoHtml.php is not the same as formTohtml.php.