I had been unhappy with existing ways to serve PHP under Apache for a number of reasons:
- RUID2 + mod_php is a giant security hole that lets any user to get a root account.
- MPM ITK is very slow, as it kills processes after each request.
- suPHP & CGI are both slow, as they start PHP on each request. They are also incompatible with opcode caching.
- FastCGI creates a lot of stability issues. It is hard to configure due to the way it handles processes, and doesn’t use opcode caching optimally.
- PHP FPM needs a socket/startup per customer, not that stable with Apache and creates a mess when we tried to integrate it with PHP Selector – as now PHP Selector would have to restart PHP FPM processes.
After a long time research we figured out that what we really want is to serve PHP the way it is served by LiteSpeed web server. Luckily, LiteSpeed Tech open sourced parts of it PHP process management & communication protocol.
So, we went to work – and did the rest. The result of our work is mod_lsapi – an Apache module to serve PHP. While your Apache will still be slower then LiteSpeed API, it will be much faster then with any other way to serve PHP.
Some of the benefits of mod_lsapi comparing to other ways to serve PHP:
- Speed – it is faster than any other way to serve PHP with Apache;
- Stability – it doesn’t suffer from stability issues in process management like PHP FPM;
- Utilizes full benefits of opcode caching;
- MPM Worker & Event compatible;
- Support for PHP directives in .htaccess files;
- Drop in replacement for existing ways to serve PHP;
- Fully compatible with PHP Selector.
The software is currently in beta stage, and you can find more info on how to deploy it here:
While mod_lsapi already outperforms anything available for serving PHP on Apache – there is a lot more that we plan to add to it, like:
- PHP version per directory settings;
- Faster first page response;
- Higher density;
- Adaptive process spawning.
Q: Is it available now?
A: Yes, it is available now to current CloudLinux customers.
Q: Is it open source?
A: Parts of mod_lsapi are opensourced, but not all of them. We closed source lsapi library that allows mod_lsapi to communicate with lsphp.
Q: Does it require PHP Selector?
Q: Does it require CageFS?
Q: Do I have to use it?
A: No, you can continue using whatever way to serve PHP you have used before.
Q: Can I switch it off if I don’t like it?
Q: Has it been used in production environment?
A: Yes, we have piloted it with a number of customers for the past two months to get rid of majority of issues.
CEO, Igor Seletskiy