
Today
there was a good news that from now on uWSGI server supports PHP. No, at the level of GGI he supported before, but this does not go to any comparison with support at the kernel level of the uWSGI itself.
uWSGI
For those who for some reason have not yet used this convenient and stable server - a brief reference.
uWSGI is a fast, convenient and, at the same time, reliable WSGI server.
- Fast because it is written in C.
- Convenient , because it is easily configured with all imaginable and inconceivable types:
.ini, yaml, json, XML
or via environment variables. - Reliable (in the original it sounds
self-healing
), because it has the function of self-management: if the request lasts longer than the allotted time, the master process will complete the execution of the current worker so as not to overwhelm the memory (the functionality is saying the name Harakiri mode
).
PHP plugin build
Download the php source, bind the uwsgi source to them and configure the PHP environment:
')
ln -s /usr/src/uwsgi/plugins/php /usr/src/php/sapi/uwsgi ./buildconf --force ./configure --prefix=/opt/php --with-mysql --with-uwsgi=/usr/src/uwsgi
Then build PHP with the traditional
make, make install
.
Use with Nginx
In the engineering, the processing of php requests is described by the usual section (for connecting with WSGI applications via uWSGI):
location ~ .php$ { include uwsgi_params; uwsgi_modifier1 14; uwsgi_pass 127.0.0.1:3030; }
Run uWSGI
While PHP support (as a plugin) is
in alpha state , no plugin configuration is required. And you can start the server in its use mode as follows:
uwsgi --plugins php --master --socket :3030 --processes 4
At this rate, you can soon abandon not only Apache, but also all FastCGI-php-fpm combined.
Related Links
Run PHP scripts in uWSGI:
projects.unbit.it/uwsgi/wiki/PHPRead more about Harakiri mode in WiKi:
projects.unbit.it/uwsgi/wiki