Skip to main content

cPanel 60 and PHP-FPM activate on new creation

Comments

5 comments

  • sparek-3
    This is being discussed in the feature request section PHP-FPM enabled by default on account creation Seems that this isn't a high priority item. Not really sure why cPanel 60 is being lauded with Enhanced PHP-FPM support when it lacks this basic feature. But, no worries, I'll just keep using my old system for managing this.
    0
  • cPanelMichael
    Hello @sparek-3, This isn't possible via the UI as you mentioned, however it is possible to enable PHP-FPM via the command line by using the following WHM API 1 function: WHM API 1 Functions - php_set_vhost_versions - Software Development Kit - cPanel Documentation Here's an example of a command you would use:
    whmapi1 php_set_vhost_versions version=ea-php56 php_fpm=1 vhost-0=example.tld
    Thank you.
    0
  • sparek-3
    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:
    /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
    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
    /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.
    0
  • cPanelMichael
    Hello @sparek-3, In this particular case, it's intended to match what's ed in MultiPHP Manager. "WHM >> MultiPHP Manager" will display the actual addon domain name instead of the subdomain it's associated with. Essentially, you're using the value that's defined for the "vhost" output when using the WHM API 1 php_get_vhost_versions function: WHM API 1 Functions - php_get_vhost_versions - Software Development Kit - cPanel Documentation Thank you.
    0
  • sparek-3
    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.
    0

Please sign in to leave a comment.