PHP-FPM: Socket instead of port (Apache)

I have a freshly built VPS:

Ubuntu 18.04
Virtualmin 6.09.gpl
PHP versions 7.0.33, 7.2.31, 7.4.7
Apache 2.4.29

So far everything is running well.

I’m in the process of switching Apache from mpm-prefork to mpm-event and php-fpm.

I’m using mpm-event & php-fpm on my outgoing server - the main difference being that the old server is using TCP ports for php-fpm (one for each domain\Virtual Server) and for the newly built one, I’m looking at using sockets.

[along with one php-fpm pool per domain\Virtual Server].

I can manually set Apache\PHP up to do this - but is there anyway I can do this via Virtualmin, so that each time I create a new Virtual Server\domain in Virtualmin - the correct entry for the user specific socket gets created in the domain\user conf file in /etc/php/7.x/fpm/pool.d directory?

Thanks in advance

Dibs

Virtualmin/System Settings/Server Templates then PHP options. Is FPM an option for Default PHP execution mode?

@ramin - thanks for the reply.

Execution mode is there and that can\will be changed but my understanding is that that doesn’t give you the choice between sockets and ports.

Basically I’m wanting a pool per user\domain\Virtual Server - Virtualmin will do that but I’m wanting a socket per pool, not a port per pool. if that makes sense?

Thanks

DIbs

Hi,

No, Virtualmin doesn’t support a use of sockets for PHP-FPM, in favor of using ports. There is nothing wrong in using ports for PHP-FPM processes and upcoming Virtualmin 6.10 will also have a configurable option to set base port number for FPM servers:

1 Like

@Ilia - Many thanks for the answer.

I think I’ll leave the sockets rabbit-hole alone and stick with ports . :wink:

Many Thanks

Dibs

I’m using Redis for caching and PHP’s session handler and it’s connecting over Unix sockets… if that’s pertinent to what you were hoping to achieve.

Hi Ramin,

Thanks for the reply.

I was just configuring\optimizing Apache, PHP & MySQL (yet to do). For me that means switching Apache to mpm-event, moving to php-fpm (using 1 pool per user\domain) and not got round to looking what I did to MySQL on the existing server.

From what I’ve read sockets to perform (somewhat) better, but it’s not the end of the earth using ports.

Thanks

Dibs

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.

@Jamie Jamie has implemented the support for sockets for the next (one that’s happening after 6.16) Virtualmin release.

2 Likes