Getting a 500 error with no useful information in the error log

Hi,

My web application won’t launch, I’m getting a 500 error code. When I look in the error log file, I get entries like this:
[Tue Aug 28 11:42:38.643144 2018] [cgi:error] [pid 6878] [client :34985] AH01215: Can’t use an undefined value as a symbol reference at /var/www/html/mywebsite.cgi line 118.
[Tue Aug 28 11:42:38.646338 2018] [cgi:error] [pid 6878] [client :34985] End of script output before headers: mywebsite.cgi

So, I’m not sure about what’s going on (why can’t the report be more verbose?).
On my Mac, the app runs fine. I then compile it for Linux (my server’s OS), upload it with its resources folder and cgi file (as binary mode) set the permissions and… error 500.

What may I do next?

Check if you can run a simple test cgi, maybe there is a missing/wrong configuration on your server.

With the example you provided, I’m getting this:
-bash: ./hello.cgi: /usr/local/bin/perl^M: bad interpreter: No such file or directory

Strange, as my website used to work 6 months ago. What does that error mean? Something has been removed?

Thank you.

It looks like the hello.cgi file was created on a windows system using something like notepad. The ^M at the end of each line needs to be removed for it to work on unix.

Also check if perl is in /usr/local/bin

This work as hello.cgi on my unix server:

[code]#!/usr/bin/perl

print "Content-type: text/html

";
print "Hello, world!
";[/code]

And 755 for permissions.

@Arnaud Nicolet - make sure your FTP program is transmitting things correctly. The cgi and config file’s should be ASCII and just about everything else should be binary (unless you’re copying other text files)

Permissions should be 755 on the CGI, app and the Libs directory and it’s contents. 644 on everything else.

FWIW, the error messages you are seeing come from your web server or the Perl interpreter itself. The Xojo app hasn’t even launched yet, so there’s no “better” error for us to provide.

Now, the error that you provided in the first post… that could be caused by the app crashing.

In the terminal go to the directory where your app is and try two these things:

ldd mywebsite
./mywebsite

Actually, I’ve written this file on a Mac, using the application “Transmit” (an FTP client that have editing capabilities).

[quote=403012:@Alberto De Poo]Also check if perl is in /usr/local/bin
[/quote]
It looks like this is the problem (I don’t get why, since it used to work).
“ls /usr/local/bin” returns this:
“myvncserver noip2”.

Edit: however, I have the /usr/bin/perl file already installed. My installation is broken?

Thank you.

Ok, I changed from Auto mode to explicit Binary/ASCII. Same error 500.

This led to this message:
“Cannot write to config at path /var/www/html/test/config.cfg. Permission denied”. So I added write permissions to that file and am back with the error code 500.

Thanks.

In my installation I have perl in /usr/bin/perl, that’s why my hello.cgi first line is #!/usr/bin/perl

So if your installation is the same, create a hello.cgi file, copy the code I posted above, change permissions to 755 and make sure it works. If it doesn’t work, then there is something missing in your webserver configuration.

Thanks for enlightening me.

[quote=403016:@Greg O’Lone]Now, the error that you provided in the first post… that could be caused by the app crashing.[/quote] How could it be crashing if the app hasn’t launched?

[quote=403016:@Greg O’Lone]In the terminal go to the directory where your app is and try two these things:

ldd mywebsite
linux-vdso.so.1 (0x00007fff5d547000)
XojoConsoleFramework64.so => /var/www/html/./MyWebSite Libs/XojoConsoleFramework64.so (0x00007f4d0f331000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4d0ef86000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f4d0ed33000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f4d0ea24000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4d0e807000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4d0e603000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4d0e3fb000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4d0e0fa000)
libunwind.so.8 => /usr/lib/x86_64-linux-gnu/libunwind.so.8 (0x00007f4d0dedf000)
libunwind-x86_64.so.8 => /usr/lib/x86_64-linux-gnu/libunwind-x86_64.so.8 (0x00007f4d0dcbf000)
libc++.so.1 => /var/www/html/./MyWebSite Libs/libc++.so.1 (0x00007f4d0d90e000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4d0d6f8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4d11847000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f4d0d4f0000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f4d0d282000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f4d0d05f000)

Here, the terminal waits a couple of seconds and returns to the prompt without writing anything. Is that the expected result?

Thank you.

[quote=403061:@Alberto De Poo]In my installation I have perl in /usr/bin/perl, that’s why my hello.cgi first line is #!/usr/bin/perl

So if your installation is the same, create a hello.cgi file, copy the code I posted above, change permissions to 755 and make sure it works. If it doesn’t work, then there is something missing in your webserver configuration.[/quote]
Ok, so there’s something missing… (same error). How can I know what is missing? Or can I reinstall perl?

Thanks.

Is not perl problem, is your webserver configuration.

I have seen some Apache installation with the cgi-bin directory not configured (can’t execute .cgi files on that server) and others without cgi-bin directory.

So you need to check your webserver configuration, make sure you have cgi configured and after the hello.cgi runs without error 500 then you could start looking at running Xojo web.

Which Linux distro? I’ve seen this in CentOS 6 (The 500 error) and always is gone by deleting the htaccess file in the application folder. Don’t know why. In CentOS 7 works with it, perhaps by the Apache version.

Sometimes getting this error if update the application, and the old one is running when open the new. Then killing the process solves it.

Yes. Cgi apps expect to get data from the cgi script and will quit automatically if they don’t. What it does tell us is that there are no plugin library requirements that are not met in the open event.

Well, it is probably launching, however briefly, and then quitting again before it has a chance to respond. In terms of cgi web apps, that’s usually due to a crash.

Have you tried an empty or simple web project to see if that works? One that we know has no other issues?

[quote=403069:@Alberto De Poo]Is not perl problem, is your webserver configuration.

I have seen some Apache installation with the cgi-bin directory not configured (can’t execute .cgi files on that server) and others without cgi-bin directory.

So you need to check your webserver configuration, make sure you have cgi configured and after the hello.cgi runs without error 500 then you could start looking at running Xojo web.[/quote]
What’s weird is it worked some weeks ago; but, the problem is solved (I’m going to answer to everyone and write what I’ve done in the end).

Thanks for your answer.
It’s a Debian server.
However, my problem is now solved by other means.

[quote=403147:@Greg O’Lone]Well, it is probably launching, however briefly, and then quitting again before it has a chance to respond. In terms of cgi web apps, that’s usually due to a crash.

Have you tried an empty or simple web project to see if that works? One that we know has no other issues?[/quote]
Yes, a simple project was also failing.

In the meantime, I’ve rebuilt the packages (using aptitude): still error 500; then, I’ve issued a “reboot” command to restart the server. This worked! My applications are working the way they used to work!

Now, I’m concerned about the reliability of my server… If I have to restart it every couple of months (as I already did for other reasons), I may not notice it soon enough. Does what I’ve had to do mean something is broken in my web server?

Thank you.