SOLVED cPanel 60 and PHP-FPM activate on new creation

sparek-3

Well-Known Member
Aug 10, 2002
2,138
260
388
cPanel Access Level
Root Administrator
Is the only way to enable PHP-FPM for a VirtualHost with cPanel 60 is to log into the WHM and use the MultiPHP Manager to activate PHP-FPM? Is there not a way to do this through the command-line? Am I missing something?

Without being able to do this from the command-line, how can we do this on hookable events (such as new account creations) so that all VirtualHosts are PHP-FPM from the get-go?

Previously, I had created an event to add PHP-FPM configuration and Apache Includes on account creation (I've been doing PHP-FPM per account instead of per VirtualHost, I note that cPanel 60 is doing this per VirtualHost, i.e. different pools for addons and subdomains). I can't figure out how to make this work with cPanel 60's PHP-FPM. Perhaps I'm missing something.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463

sparek-3

Well-Known Member
Aug 10, 2002
2,138
260
388
cPanel Access Level
Root Administrator
What is vhost-0 suppose to be?

Shouldn't this refer to whatever the ServerName is set to in httpd.conf?

This doesn't appear to be the case for addon domains.

If you have the main domain name animals.tld and you create an addon domain cats.tld - essentially what you are doing is creating a subdomain (cats.animals.tld) and parking (cats.tld) on top of this subdomain. Meaning that the ServerName is cats.animals.tld (cats.tld and www.cats.tld being ServerAlias's).

However when you try to enable PHP-FPM for cats.animals.tld:

Code:
/usr/local/cpanel/bin/whmapi1 php_set_vhost_versions version=ea-php56 php_fpm=1 vhost-0=cats.animals.tld
This results in an error

Code:
The system failed to apply the “PHP” version to “cats.animals.tld”: Cpanel::Exception::DomainNameNotAllowed/(XID feqbyv) The supplied domain name is invalid
If you use cats.tld then this works

Code:
/usr/local/cpanel/bin/whmapi1 php_set_vhost_versions version=ea-php56 php_fpm=1 vhost-0=cats.tld
I would caution to think about backwards compatibility here. Addon domains like this (at least as far as I know) have always been referenced from their subdomain counterpart.

For example, if you want to include additional parameters for this VirtualHost in Apache, you have to create the directory /etc/apache2/conf.d/userdata/std/2_4/%user%/cats.animals.tld using cats.tld won't work.

In fact the created PHP-FPM conf file is - /opt/cpanel/ea-php56/root/etc/php-fpm.d/cats.animals.tld.conf and the pool name is cats_animals_tld.

Is this an oversight?

While I can certainly appreciate the readability of vhost-0=cats.tld vs. vhost-0=cats.animals.tld I think you may run into backwards compatibility issues later on when you have to explain that addon domains are referenced as their addon domain name for PHP-FPM configuration, but referenced as their subdomain counterpart every where else.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463

sparek-3

Well-Known Member
Aug 10, 2002
2,138
260
388
cPanel Access Level
Root Administrator
OK. I can make this work this way. But I don't really agree with it. I think it's a slippery slope when you start mixing and matching one thing to mean one thing over here and to mean another thing over there.

One of the issues I have with cPanel's development is that you sometimes seem to lack foresight into how things will be handled in the future. A feature or item might look good now, but then has to be changed two versions later because nobody in development thought of how it would actually be implemented.