[Twisted-Python] problem with twcgi.PHPScript

Ottavio Campana ottavio at campana.vi.it
Sat Jan 12 11:52:25 EST 2008

Hi, I'm trying  to add the possibility of executing  some php pages from
an application developed with twisted web.

I define the  VWGPhpScript class as follows,  adding the REDIRECT_STATUS
because the debian package complains about it.

class VWGPhpScript (twcgi.FilteredScript):
  filter = '/usr/lib/cgi-bin/php5'
  def runProcess(self, env, request, qargs=[]):
    p = twcgi.CGIProcessProtocol(request)
    env['REDIRECT_STATUS'] = '200'
    reactor.spawnProcess(p, self.filename, [self.filename]+qargs, env, os.path.dirname(self.filename))

This is the error I get:

2008/01/12 17:34 CET [-] CGI /directory/index.php exited with exit code 1
2008/01/12 17:34 CET [-] Errors from CGI /directory/index.php: Upon execvpe /tmp/index.php ['/tmp/index.php'] in environment id -1217401212
        :Traceback (most recent call last):
          File "/usr/lib/python2.4/site-packages/twisted/internet/process.py", line 377, in __init__
            command, args, environment)
          File "/usr/lib/python2.4/site-packages/twisted/internet/process.py", line 539, in _execChild
            os.execvpe(command, args, environment)
          File "os.py", line 350, in execvpe
            _execvpe(file, args, env)
          File "os.py", line 367, in _execvpe
            func(file, *argrest)
        OSError: [Errno 13] Permission denied

What's the meaning of permission denied? I tried running the application
as root, it didn't change... The php  file is in /tmp and this directory
in attached as a child called directory of the root.

More information about the Twisted-Python mailing list