Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

c++ cURL and CGI on Red Hat

I have a c++ cgi program that uses cURL to communicate to paypal. I'm attaching the whole file. There's a lot of commented out nonsense in there from various things I've tried, but I don't think the code is the problem anyway. So here we go.

I can run a cURL program in c++ from the command line. I'm using cURLpp and I ran the examples with no problem.

If I run the compiled CGI it dies with no error, and no message whatsoever at request.perform(). By dies I mean, if I don't print the necessary http headers before running perform() I get a "Premature end of script headers" error and apache goes 500 on me. If I do print out the headers I simply get a blank white screen.

I have a series of catch blocks set up, the last of which is a catch all. None of them are called.

After some tinkering I discovered that if I don't set the URL option I can run perform() just fine. Of course it hits one of the catch blocks and throws the error that the URL is not set, but it doesn't just die. I can set any option except URL without a problem.

So here are my thoughts, permissions issue with the cgi using an outgoing port. I'm running from the command line with root, and while I set the cgi program to be owned by root, it doesn't seem to be working out for me.

I've tried changing the owner and group of the example file that worked to match those of the cgi application and the example still worked. So maybe it's using a different port within the compiled CGI?

The problem is, while I can get around in unix, I wouldn't even know where to begin looking for something like this. How do I check whether or not this could be a permissions issue? Does that even sound like it could be the cause? How would I go about remedying something like that?

I'm getting pretty desperate here. I'm in over my head and I'm starting to drown a little bit.

Thanks,
Brandon

Comments

  • tatebntatebn Member Posts: 3
    I ran ldd on both the testing.cgi and the example06 executable and here's what I got. This could be the problem. Notice different versions of libcurl. Two versions of libssl in testing.cgi.

    How would I go about fixing this?

    testing.cgi

    libmysqlclient.so.10 => /usr/lib/mysql/libmysqlclient.so.10 (0x4001e000)
    libcrypt.so.1 => /lib/libcrypt.so.1 (0x40055000)
    libpfpro.so => /usr/local/verisign/payflowpro/linux/lib/libpfpro.so (0x40082000)
    libcurlpp.so.0 => /usr/lib/libcurlpp.so.0 (0x40128000)
    libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40152000)
    libidn.so.11 => /usr/lib/libidn.so.11 (0x40205000)
    libssh2.so.1 => /usr/lib/libssh2.so.1 (0x40236000)
    libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x40257000)
    libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0x4028a000)
    libldap.so.2 => /usr/lib/libldap.so.2 (0x4038f000)
    libgssapi_krb5.so.2 => /usr/kerberos/lib/libgssapi_krb5.so.2 (0x403c1000)
    libkrb5.so.3 => /usr/kerberos/lib/libkrb5.so.3 (0x403d4000)
    libk5crypto.so.3 => /usr/kerberos/lib/libk5crypto.so.3 (0x40433000)
    libz.so.1 => /usr/lib/libz.so.1 (0x40443000)
    libm.so.6 => /lib/tls/libm.so.6 (0x40451000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40473000)
    libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
    libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4047b000)
    libcurl.so.4 => /usr/lib/libcurl.so.4 (0x4048a000)
    libnsl.so.1 => /lib/libnsl.so.1 (0x4051c000)
    libssl.so.4 => /lib/libssl.so.4 (0x40531000)
    libcom_err.so.3 => /usr/kerberos/lib/libcom_err.so.3 (0x40566000)
    libresolv.so.2 => /lib/libresolv.so.2 (0x40568000)
    libdl.so.2 => /lib/libdl.so.2 (0x4057b000)
    liblber.so.2 => /usr/lib/liblber.so.2 (0x4057f000)
    libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x4058b000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

    example06

    libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4001e000)
    libcurl.so.3 => /usr/local/lib/libcurl.so.3 (0x400d1000)
    libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x400fe000)
    libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0x40131000)
    libdl.so.2 => /lib/libdl.so.2 (0x40236000)
    libz.so.1 => /usr/lib/libz.so.1 (0x4023a000)
    libm.so.6 => /lib/tls/libm.so.6 (0x40249000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4026b000)
    libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
Sign In or Register to comment.