Re: Static library works everywhere but server



I must be forgetting something (up all night).

I installed sqlite database on FreeBSD. Wrote a small piece of code
to read two columns and it works. Transferred to an Ubuntu box and
recompiled. It works there, too. Uploaded to my hosts server, which
is CentOS, but, when accessing the page, I get a "Premature end of
headers" 500 error.

Usually I'll get this error if I forget to send the http headers but
this isn't the case here.

Another common cause for that type of error is an error message
generated *BEFORE* the headers but not in the proper format for
headers. This would include linker complaints about not being able
to find shared libraries. It might also include snide library
comments about gets() being deprecated and being unsafe to use (it
*IS* unsafe to use). With Perl, it may include complaints about
missing include files.

It is also possible to get that error with permission problems on
the executable or any directories above it. Note that with Apache
permissions that are too liberal (e.g. writable by everyone) are
as bad as permissions that are too strict.

When I initially set up sqlite on my boxes, I do:
./configure --disable-shared --enable-static (from a post on Apple's
board)
sudo make install

I get libsqlite3.a, along with libsqlite3.so in /usr/local/lib.
Then:
gcc -c mycode.c
gcc -L/usr/local/lib mycode.o -lsqlite3 -o mycode

Running all that gives me an executable that prints out the correct
values on FreeBSD and Ubuntu but gives the error mentioned above.

If "mycode.c" is rewritten to just printf("hello world"); but without
linking to sqlite, it works correctly on the server. The only thing
"mycode" does is extract a value from the database and prints it.
The simple database of two values is loaded on the server in the same
folder (cgi-bin).

One way to *TRY* to test this is to emulate the web server. su to
the user that Apache or whatever it is runs as, and try to manually
execute the CGI, setting up the environment variables just as Apache
would. If you get warnings or errors *before* the headers, or
forget the blank line between the headers and the content, this is
a problem. Note that on leased space on a server, you may not be
able to do this test.

Also, try to find something meaningful in the server logs.

The static library is about 1Mb, so I would have thought the
executable would be about the same but it's only 7K. I'm thinking
it's linking with the shared libraries instead? If I compile with -
static, I get a bunch of errors for functions using pthread.

At that point, I have to take a nap. Been up all night and this was
the last thing to do.


.



Relevant Pages

  • Re: What commands can a user execute
    ... the query - yes, I'm aware of it - either at the Server or Database scope, no ... full list of SQL commands that a user can execute but, so far, it has not. ... mapped to any server roles but is a db_owner in almost all databases. ...
    (microsoft.public.sqlserver.security)
  • Re: setting DTS Global Variables
    ... I would like to execute the DTS from the command line, ... I do not want to change the database object names ... >> destination of the file to a different server through code. ...
    (microsoft.public.sqlserver.dts)
  • Re: Effective Permissions Error with Domain User
    ... I set the database compatibility to 2005. ... server profile trace and found that it was calling the Execute As User. ... This leads me to believe it is some sort of permissions issue. ... Did you get these database from SQL Server 2000 by using a RESTORE command? ...
    (microsoft.public.sqlserver.security)
  • Re: New user with no permissions can see and execute system stored procedures...
    ... Using SQL Server 2005, I create a new server login and ... Now when I open the database the newly created user is able to see (in SQL ... Server Management Studio GUI) and execute _system_ stored procedures. ...
    (microsoft.public.sqlserver.security)
  • Re: Using exec function to get a .exe return status gives CGI Error
    ... If I execute the command with cmd (I use Windows 2003 ... The browser makes a request, the server MUST respond with headers, even if no data is sent. ...
    (comp.lang.php)

Loading