Question about install support for python and php together

I get a vps host and install php already with spawn-fcgi.
And you could see my steps here:

Now I want to add support python (web.py) in this host,
http://webpy.org/cookbook/fastcgi-nginx
and try the steps in web.py, but can’t work correct.
just get
spawn-fcgi: child exited with: 2

Who could tell me the steps I should do?

Many thanks,

sagasw

The problem is that FCGI is a bag of crap and anything non-thread safe
will usually crash it. You either have a babysit it with something like
Monit, or use something more modern like uWSGI or Gunicorn. uWSGI is a
wsgi server written in C and needs to be compiled as well as requires a
compiled version of Nginx, although this is recommended anyway because
the Debian Aptitude version of Nginx is so damn old. Gunicorn is a 100%
wsgi server and shares many of the same benefits as uWSGI, but has not
been as fast in my tests. Either of these, your app will be the slow
part, not the wsgi server so it doesn’t matter.

Hope this helps.

On 06/05/2010 04:17, sagasw wrote:

Who could tell me the steps I should do?
I’ve personally had nothing but problems with spawn-fcgi and stopped
using it years ago. The -b switch for the php-cgi config tells PHP to
bind to an address:port, so you don’t really need spawn-fcgi as long as
something can keep an eye on the process.

We use supervisord to spawn & manage both PHP & Python services which
sit behind nginx. A supervisor config with something like the following
should get you going:

[program:PHP]
command=/usr/bin/php-cgi -c /etc/php.ini -b 8888
autostart=true
environment=PHP_FCGI_MAX_REQUESTS=100,PHP_FCGI_CHILDREN=3

[program:MyPythonProgram]
directory=/path/to/my/py/app/dir
command=/usr/bin/python mywsgiapp.py

Then in your nginx config simply create a config file for each FCGI
environment (php/python) and add any “backends” (for python,
specifically) to your vhosts.

You can even use supervisord to start/manage your nginx instance. We
have supervisord manage everything, and have monit keeping an eye on
supervisord as an added bonus.

You can see more on supervisord at http://supervisord.org, however the
site is going through a server move at the moment so they’ve only got
the manual up at the moment.

Phillip B Oldham
ActivityHQ
[email protected] mailto:[email protected]


Policies

This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to
anyone.

This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.