Help with my first web application

Yesterday I built my first Xojo web application and copied the files to a directory called ‘test’ on my web server. Initially there seemed to be a problem with the web server reading the files so I changed the permissions so everyone could read and write to the directory and all its files.

Following some googling, I also did chmod 755 on the application and .cgi file (but I’m not sure now whether this was before or after I used Finder to change directory permissions…)

Then the application ran beautifully. I was excited!

Today I rebuilt the application and moved the built files to a new directory with a more sensible name. I initially had access permission problems which I seem to have solved but now I get:

Server error!

The server encountered an internal error and was unable to complete your request.

Error message:
End of script output before headers: freshplants.cgi

Error 500

localhost
Apache/2.4.9 (Unix) PHP/5.5.11 OpenSSL/1.0.1g mod_perl/2.0.8-dev Perl/v5.16.3

The last entries in the apache error log are:

[Wed Aug 20 18:38:23.486252 2014] [cgi:error] [pid 5437] [client ::1:65097] AH01215: Can’t use an undefined value as a symbol reference at /Users/ChrisCurtis/Websites/freshplants/freshplants.cgi line 118.
[Wed Aug 20 18:38:23.487493 2014] [cgi:error] [pid 5437] [client ::1:65097] End of script output before headers: freshplants.cgi

Line 118 in my fresh plants.cgi file is:
print $sock $body;

I’m wondering if there is a problem with creating the socket in the CGI script but I don’t know where to go from here.

Can you offer any suggestions?

Your app is crashing before it has a chance to respond to the CGI request.