Error web app.Won't start.

Always, at least almost always, I get this error after a new WEB-installation.
But now there is no solution

[quote]Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.[/quote]
It is a CentOS 6.6 32-bit on which I install
webserver
Desktop
yum install libicu.i686
selinux disabled
firewall off
version of the build Xojo 2014r3
But even with a version 2015r3 I get the same error.

[quote][root@itweb conlocweb]# ./conlocweb.cgi
Use of uninitialized value $ENV{“REQUEST_METHOD”} in string eq at ./conlocweb.cgi line 110.
Can’t use an undefined value as a symbol reference at ./conlocweb.cgi line 118.
[root@itweb conlocweb]#
[/quote]

[quote] 110 if ($ENV{‘REQUEST_METHOD’} eq ‘POST’) {
111 read(STDIN, $sin, $ENV{‘CONTENT_LENGTH’});
112 }
113
114 $body .= create_value(TYPE_VALUE,“STDIN”);
115 $body .= create_value(TYPE_VALUE,$sin);
116 $body = create_value(TYPE_STRUCT,$body);
117
118 print $sock $body;
[/quote]
I have 4 installations with CentOS 6.6 installed like described above and permissions as follows:

[quote]rw-rw-rw- 1 apache apache 53 Oct 16 10:55 config.cfg
rwxrwxr-x 1 apache apache 5048557 Oct 16 10:55 conlocweb
rwxrwxr-x 1 apache apache 7023 Oct 16 04:33 conlocweb.cgi
drwxrwxr-x 2 apache apache 4096 Oct 21 14:48 conlocweb Libs
drwxrwxr-x 3 apache apache 4096 Oct 21 14:48 conlocweb Resources
[/quote]

What is wrong with this installation?

First of all, you can’t just run the cgi script from the command line and expect to get no errors. Cgi expects certain environment variables to be set by the web server when it is called, and that’s why you’re getting those errors.

That said, Internal Server Errors are usually caused by one of several situations:

  • The directory is not set up to run .cgi files
  • You didn’t to upload the .htaccess file (it’s hidden, so if you didn’t upload the whole directory, you could have missed it)
  • The binary is compiled for the wrong platform… Make sure you built for Linux and not OS X
  • All of the items in the Libs directory should also have their executable bits set
  • The enclosing directory should also have its executable bits set

The directory is not set up to run .cgi files
I have 4 servers who are setup the same way. This server won’t do it
You didn’t to upload the .htaccess file (it’s hidden, so if you didn’t upload the whole directory, you could have missed it)
It is there
The binary is compiled for the wrong platform… Make sure you built for Linux and not OS X
I copied from a working installation CentOS 6.6 32-bit. It is not the first installation I do.
All of the items in the Libs directory should also have their executable bits set
They are the same
The enclosing directory should also have its executable bits set
drwxrwxrwx 5 apache apache 4096 Oct 21 15:37 conlocweb

I get this from /var/log/httpd/error.log

[quote][Wed Oct 21 14:39:11 2015] [error] [client 91.181.24.204] Premature end of script headers: conlocweb.cgi
[Wed Oct 21 14:39:11 2015] [error] [client 91.181.24.204] File does not exist: /var/www/html/favicon.ico
[Wed Oct 21 14:39:11 2015] [error] [client 91.181.24.204] File does not exist: /var/www/html/favicon.ico
[Wed Oct 21 14:55:18 2015] [error] [client 91.181.24.204] Can’t use an undefined value as a symbol reference at /var/www/cgi-bin/conlocweb/conlocweb.cgi line 118.
[/quote]

Well, based on the error message, it still looks like the server is not setting the cgi environment variables properly because REQUEST_METHOD is what it’s complaining about.

I located the problem.
I referring in my app to a parameter file on the server. The directory, containing the parameter textfile, has not sufficient permissions.
So actually the error for ‘undefined variable’ was the impossibility to read a parameter file. The path to this file ‘/home/maindir/subdir/’ was not accessible.
Subdir hat all permissions
maindir did not.

It is always the same problem: “Mostly only small things matter”
and computers are like women ‘they mostly don’t say what they mean to say’.

Thanks for your time.
I hope this helps for somebody else.