Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


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

Re: Help me resolv this cgi:error

From Joe Beanfish <joebeanfish@nospam.duh>
Newsgroups comp.os.linux.misc
Subject Re: Help me resolv this cgi:error
Date 2016-02-18 15:17 +0000
Organization A noiseless patient Spider
Message-ID <na4nb4$qu2$1@dont-email.me> (permalink)
References <9a97c0dd-f7e4-44b1-a33d-562d48631443@googlegroups.com> <na1ut2$igu$1@dont-email.me> <7463f9d2-8be0-4b32-ba66-9bcfea397269@googlegroups.com>

Show all headers | View raw


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.

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