[Twisted-Python] problem with twcgi.PHPScript

Yuri Ginsburg yginsburg at gmail.com
Sat Jan 12 17:16:03 MST 2008


Looks that you are passing you are passing your script's file name as
second argument to spawnProcess method instead of passing filter
(which '/usr/lib/cgi-bin/php5'), so spawnProcess tries to spawn
/tmp/index.php which, most probably, does not have execute
permissions.

I'd try

reactor.spawnProcess(p, self.filter, [self.filtrer,
self.filename]+qargs, env, os.path.dirname(self.filename))

-- 
Yuri Ginsburg (YG10)

On 1/12/08, Ottavio Campana <ottavio at campana.vi.it> wrote:
> 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.
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>




More information about the Twisted-Python mailing list