Undefined value - cgi

Syslog message from app running on my Mac Mini server:

[quote][Fri Jan 29 15:57:11.872796 2016] [cgi:error] [pid 37461] [client 127.0.0.1:61038] AH01215: Can’t use an undefined value as a symbol reference at /Library/Server/Web/Data/Sites/Default/bin-cgi/RVCWS2233/RVCWS2233.cgi line 118.: /Library/Server/Web/Data/Sites/Default/bin-cgi/RVCWS2233/RVCWS2233.cgi
[Fri Jan 29 15:57:11.873507 2016] [cgi:error] [pid 37461] [client 127.0.0.1:61038] End of script output before headers: RVCWS2233.cgi[/quote]

Line 118: print $sock $body;

This app is a web server app, which can add records or return a list of records from a MySQL DB.

The desktop app, which call the web app, receives the following error message:

[quote]

500 Internal Server Error

Internal Server Error

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

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


Apache Server at jimasmith.com Port 80 [/quote]

Running the web app in a debug mode it runs as expected, using the same DB.

What’s in the error log?
If you’re just using the regular built in Apache server, check /private/var/log/apache2/error_log

[quote=244038:@Tim Parnell]

What’s in the error log?
If you’re just using the regular built in Apache server, check /private/var/log/apache2/error_log[/quote]

I’m running an Apple Mac Mini Server, which is apache2. The error message is as quoted above.

I didn’t know if maybe the apache error log had more details or anything.
“Can’t use an undefined value as a symbol reference” in relation to print $sock might mean a MySQL connection error.

Got a different error trying to add a record to the DB. Below is the message:

I don’t see any error with DB.

Yeah, 500 Internal Server Error is what I was getting when MySQL was inexplicably off while I was testing everything locally with my new toolkit (trying so hard not to make a plug because I’m switching servers right now and it’s embarrassing lol.)

There’s a connection issue to MySQL somewhere.

Just started having this issue too. Works fine in the IDE but when deployed to Apache2, I get these 2 errors repeatedly (thousands) logged to /var/log/apache2/site-error.log

[Sat Jan 30 13:31:54.987127 2016] [cgi:error] [pid 14526] [client 10.10.0.82:64678] AH01215: Can’t use an undefined value as a symbol reference at /mnt/data/www/site/cgi-bin/app/app.cgi line 118., referer: https://site/cgi-bin/app/app.cgi
[Sat Jan 30 13:31:54.987269 2016] [cgi:error] [pid 14526] [client 10.10.0.82:64678] End of script output before headers: app.cgi, referer: https://site/cgi-bin/app/app.cgi

Line #118: print $sock $body;

No additional information in Apache’s error.log

I have

  1. successfully connected to MySQL from the web server using the credentials app.cgi is configured to use (and pulled data from the DB)
  2. zipped up the build files in a tar ball, used FileZilla (in Active mode) to copy the files to the server
  3. verified permission and ownership of all files and directories
  4. copied files/directories to the server using just FileZilla (in Active mode) – This is normally the method I use to update the files and haven’t had any issues in the past

I have a few other Xojo cgi apps running just fine on the same server. They also connect to the same MySQL server.

Are you using ActiveRecord as well?

It’s not ActiveRecord. Have routine that uses Prepared Statements, (not using ActiveRecord), and it also has error.

I think it has something to do with MySQL user/password/location.

I have other app that use MySQL that are working ok. The difference is the app connecting to the DB. The one running on the server get an error. The ones not running on the server works ok.

Have you checked the permissions on the database? MySQL may not be allowing localhost connections for the user you are connecting with.

This is why you are being asked about ActiveRecord.

I’m not using ActiveRecord. The app is successfully establishing a connection to the MySQL server as noted in the app’s log file. The app is rapidly respawning with the “undefined value” messages I noted above.

{"timestamp":1454189041,"num":0,"desc":"Database","msg":"Attempting to establish connection to SQL Server..."} {"timestamp":1454189041,"num":0,"desc":"Database","msg":"Connection successful"}

I wasn’t replying to you but instead to the OP.

I’ll split my issue off to a new topic so we don’t get confused.

[quote=244244:@Greg O’Lone]It sounds like the app is crashing. The “End of Script Output before headers” error means that the script didn’t get a response from the app itself.

I’d try putting some code in the App.UnhandledException event and write the stack and error info from the exception object with System.DebugLog.[/quote]
From the other topic https://forum.xojo.com/conversation/post/244244

I’ve had ActiveRecord give me an error: “The table needs to have a primary key”

The table is set up as:

Dim sql As String sql = "CREATE TABLE t_rvcuse2233 (ID Integer NOT NULL AUTO_INCREMENT PRIMARY KEY,"+ _ "opsys Text,"+ _ "runcount Integer,"+ _ "regserial Text,"+ _ "appver Text,"+ _ "datepost TimeStamp,"+ _ "cpuserial Text,"+ _ "ip Text,"+ _ "path Text,"+ _ "reccount Integer);"

Check the table with phpMyAdmin does not show that information. Look at some other table that also have primary keys and they do not show either.

If ActiveRecord has been having this exception that may be the reason the app is crashing, thinking that the table is bad.

FIXED!

I think the root problem is with my Apple Server, which run on a Mac Mini. There was a recent update to the Server software from Apple.

Problem:

Browser on the server can no longer connect to my site using using my url. As an example: “www.jimasmith.com/test.php” I have to use “localhost/test.php”

What I had to was change the:

#if DebugBuild then gDb.Host = "jimasmith.com" #else gDb.Host = "localhost" #endif

Also had another DB problem, some how my messing around with it caused the primary key field to get mess up, which I think (hope) is fixed.