Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.os.linux.misc > #16807

Re: Help me resolv this cgi:error

From Robert Riches <spamtrap42@jacob21819.net>
Newsgroups comp.os.linux.misc
Subject Re: Help me resolv this cgi:error
Date 2016-02-20 03:44 +0000
Organization none-at-all
Message-ID <slrnncfo8t.q2a.spamtrap42@one.localnet> (permalink)
References (1 earlier) <na1ut2$igu$1@dont-email.me> <7463f9d2-8be0-4b32-ba66-9bcfea397269@googlegroups.com> <na4nb4$qu2$1@dont-email.me> <13016ad4-9500-4532-a837-3369ecc6ea06@googlegroups.com> <na7s5g$qu2$2@dont-email.me>

Show all headers | View raw


On 2016-02-19, Joe Beanfish <joebeanfish@nospam.duh> wrote:
> On Thu, 18 Feb 2016 07:30:14 -0800, Nikos Gr33k wrote:
>> ???? ????????????, 18 ?????????????????????? 2016 - 5:20:59 ??.??. UTC+2, ?? ?????????????? Joe
>> Beanfish ????????????:
>>> On Thu, 18 Feb 2016 06:49:39 -0800, Nikos Gr33k wrote:
>>> > > > I recentely changed VPS server and when i try to load my webiste
>>> > > > iam receiving 500 error which i wasnt receiving in my old VPS
>>> > > > server
>>> with
>>> > > > the same exact cgi scripts.
>>> > > > 
>>> > > > After looking at Apacher's error_log iam seeing the following
>>> > > > output when i try to load scripts from cgi-bin directory.
>>> > > > 
>>> > > > 
>>> > > > [Tue Feb 16 21:28:55.970302 2016] [cgi:error] [pid 17478] [client
>>> > > > 180.76.15.28:21311] End of script output before headers:
>>> metrites.py
>>> > > 
>>> > > Try running it manually as the same user it runs as in CGI to see
>>> > > what it does output. Or direct it's output to a file for testing.
>>> > > 
>>> > [root@nexus cgi-bin]# /usr/bin/python3 ./metrites.py Error in
>>> > sys.excepthook:
>>> > ValueError: underlying buffer has been detached
>>> > 
>>> > Original exception was:
>>> > Traceback (most recent call last):
>>> >   File "/opt/rh/python33/root/usr/lib64/python3.3/os.py", line 673,
>>> >   in __getitem__
>>> >     value = self._data[self.encodekey(key)]
>>> > KeyError: b'HTTP_USER_AGENT'
>>> > 
>>> > During handling of the above exception, another exception occurred:
>>> > 
>>> > Traceback (most recent call last):
>>> >   File "./metrites.py", line 22, in <module>
>>> >     userinfo = os.environ['HTTP_USER_AGENT']
>>> >   File "/opt/rh/python33/root/usr/lib64/python3.3/os.py", line 676,
>>> >   in __getitem__
>>> >     raise KeyError(key)
>>> > KeyError: 'HTTP_USER_AGENT'
>>> > [root@nexus cgi-bin]# ^C
>>> > 
>>> > 
>>> > You want me try running the script as the owner of the cgi-bin/
>>> > folder?
>>> 
>>> No, I want you to run it as the same user that the webserver is
>>> configured to run cgi programs as. It's almost certainly not root.
>>> 
>>> You'll also need to set environment variables as the script expects
>>> them.
>>> 
>>> export HTTP_USER_AGENT="Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36
>>> (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"
>>> export HTTP_HOST="yourservername.com"
>>> export REMOTE_ADDR=127.0.0.1 export REQUEST_URI=/cgi-bin/metrites.py"
>>> etc.
>> 
>> Thank you for the insight Please tell me how to find the user accounjt
>> under which my web server (Apadhe is running)
>> 
>> Please be as specific as you can.
>> Thanks a lot.
>> 
>
> Look in httpd.conf for the "User" setting.
> Or write a little CGI script like so
>
> #!/bin/sh
> echo "Content-type: text/plain"
> echo ""
> /usr/bin/id
>
> (just don't leave that laying around in cgi-bin when you're done though)

Or, even easier if you have access to a shell on the machine that
runs the web server:

    ps augx | egrep -i 'apache|httpd'

Look through the (most likely rather short) list for the process
in question.

-- 
Robert Riches
spamtrap42@jacob21819.net
(Yes, that is one of my email addresses.)

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Help me resolv this cgi:error Nikos Gr33k <nikos.gr33k@gmail.com> - 2016-02-16 13:33 -0800
  Re: Help me resolv this cgi:error Joe Beanfish <joebeanfish@nospam.duh> - 2016-02-17 14:08 +0000
    Re: Help me resolv this cgi:error Nikos Gr33k <nikos.gr33k@gmail.com> - 2016-02-18 06:49 -0800
      Re: Help me resolv this cgi:error Joe Beanfish <joebeanfish@nospam.duh> - 2016-02-18 15:17 +0000
        Re: Help me resolv this cgi:error Nikos Gr33k <nikos.gr33k@gmail.com> - 2016-02-18 07:30 -0800
          Re: Help me resolv this cgi:error Joe Beanfish <joebeanfish@nospam.duh> - 2016-02-19 19:58 +0000
            Re: Help me resolv this cgi:error Robert Riches <spamtrap42@jacob21819.net> - 2016-02-20 03:44 +0000
              Re: Help me resolv this cgi:error Eli the Bearded <*@eli.users.panix.com> - 2016-02-24 22:24 +0000

csiph-web