in reply to CGI and ODBC (progress)

djibel

I'm surprised no-one has mentioned it, but here goes: It appears that you've misattributed the error to CGI because you changed too many variables between your "it worked" test and your "it didn't work" test. You changed two variables: (1) whether or not you used CGI, and (2) the account you ran the program under. (You probably changed others, as well, such as running it under a web server, etc., but those are the two that are important for this example.)

You can run the program without CGI under your own account, in which case you should have seen the proper data come out. Alternatively, you could have run it under the web server account in a command-line window to see it fail to retrieve the data of interest. So remember, when you're isolating a problem, make sure you've limited the changes to a single variable before deciding on the culprit. It's far too easy to make the assumption that everything else is the same, when in fact it's not.

...roboticus

Programmer A: Hmmm ... this program ran just fine last week, but now it's giving me an error message!

Programmer B: OK, what changed?

Programmer A: Nothing!

Programmer B: Nonsense, something had to change!

Programmer A: No, really, nothing changed!

Programmer B: OK, then since you ran the program last week, why did you it today? If you changed nothing, you'll get the same answer.

Programmer A: Oh, ummm, err.... OK, the data changed.

Programmer B: OK, then that changed. What happens when you run the program with the same data?

Programmer A: I tried that a few minutes ago, and it gave me the same error message.

Programmer B: OK, then, what else changed?

Programmer A: Nothing!

Programmer B: rolls eyes...

  • Comment on Debugging tip: Change only one thing at a time (was Re: CGI and ODBC (progress))

Replies are listed 'Best First'.
Re: Debugging tip: Change only one thing at a time (was Re: CGI and ODBC (progress))
by djibel (Novice) on Apr 28, 2010 at 15:08 UTC
    That is my last test. I tried now on my own computer where CGI and ODBC work.

    1- If I use Easyphp. The script work using CGI
    2- If I stop easyphp and install apache separatly and test my cgi script. it's failed (no connection database).

    On easyphp apache and apache server, they use the same user :
    User daemon
    Group daemon

    What is the problem ?

      djibel

      It sounds like you're still changing more than one variable at a time. You can run it under your account in a command-line window without CGI and it works, right? If so, put in CGI and run it in the same command-line window, and it should still run. (The text may be a bit much to dig through, as you'll have your HTML stuff, but that ought not stop you.)

      I don't know what Easyphp is, so I can't help you move from that step to the apache configuration, though.

      ...roboticus

        I have resolved the bug, that is the solution. When I use EasyPHP, I think the apache user (deamon) run with privilege of user account used, and as my session is admin, the cgi programme work because apache user can see the DSN ODBC.

        When I use apache separately, CGI doesn't work because the user apache have not the same privilege and I don't know why.
        Then, To change it, I have opened the services (Right click on Computer folder => gestion => services ). I found apache 2 service => connexion => I deselect account local user and select this account ( I have choosing an administrator account), apply and restart the apache service. Now, the cgi script work well, I hope it will help another people.

        Thank you for your helps,

        Best Regards,

        djibel