Parse error: parse error, unexpected '{' in /home/aljohn/public_html/php_mail_test.ph

They have: 5 posts

Joined: Jan 2005

Hi,

I am trying to make a form for my first website. I use Golive 6 and have been able to create the form. Getting the form to process is another story.

I downloaded a form processing PHP file (Natemail 3.0.6) from http://www.mindpalette.com/formprocessing/index.php

The download came with a test file that you upload to your server to see if your server is configured correctly. After you upload the file you are supposed to type the path into your web browser, input you email address and see if you get an email. I tried that but all I get is the following message:

Parse error: parse error, unexpected '{' in /home/aljohn/public_html/php_mail_test.php on line 1

Anybody know what this means? I wouldn't expect the code to be bad since the site seems pretty reputable.

Can anybody suggest the next logical step to take to resolve this so I can get my form working?

Please let me know if you think this is somthing simple. I am knew to this stuff so it might just be somthing dumb I am overlooking.

Thanks, Al

He has: 1,758 posts

Joined: Jul 2002

I would suggest that for an easy start you try a cgi based formmail script. One of the most common and easy to use ones is called NMS Formmail.

You can download it here:

http://www.scriptarchive.com/nms.html

A parse error pretty much always means there is a problem with the code on the page. Since the error says the problem is on line 1, if you can post the first few lines for us we will probably be able to point out where it's gone wrong.

Andy

CptAwesome's picture

He has: 370 posts

Joined: Dec 2004

Well, a parse error like an unexpected '{' means that something in the script is written wrong, and they forgot a semi-colon, or a paranthesis.

Check to see if you uploaded via FTP in binary or ASCII, it shouldn't matter with php, but again, they might have written something wrong. Try reuploading via FTP in ASCII mode, if that doesn't work, try binary, and if none of that works, heck, post the code.

They have: 5 posts

Joined: Jan 2005

Do you know how to change the method of uploading files (binary or ASCII) in golive 6?

Also, will PHP only work in a certain directory on the server? Maybe I have it in the wrong directory.

Thanks, Al

CptAwesome's picture

He has: 370 posts

Joined: Dec 2004

Sadly haven't found anything clear on if GoLive 6 can change that. However you can use any number of free FTP programs like ftp explorer for the transfer of a few files like the script.

As to if it's in the wrong place. No. CGI would matter, becaise some servers force to the cgi-bin directory, but newer servers don't even have that restriction any more. Even that aside, php can be run from anywhere, as long as it's named .php, though php3 and some other naming schemes are supported by certain servers.

The script is running, because if it wasn't you wouldn't get a parse error.

They have: 10 posts

Joined: May 2003

well for new php its not worked now using php3 or phtml but yes php can be work on any directory even its cgi-bin directory.
for your problem try to check the code its seem there is an error typing on that script.
if can post the code so we can look the code.

They have: 5 posts

Joined: Jan 2005

I uploaded a fresh download of the file and everything seems to be working fine now.

Thanks, Al

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.