Skip to main content

php-fpm enable ssh command

Comments

5 comments

  • sparek-3
    It's not really that easy to do this. I agree with you that something needs to be done regarding this. But the way cPanel has this set up, it's just not that easy. You would have to do something like:
    /usr/local/cpanel/bin/whmapi1 php_set_vhost_versions version=ea-php56 php_fpm=1 vhost-0=%domain% /usr/local/cpanel/bin/uapi --user=%user% LangPHP php_set_vhost_versions vhost=%domain% version=ea-php56
    Adjusting %domain% to the be the domain name (or the subdomain, or the addon domain ... you have to do it for each one, which makes this method a bit cumbersome). %user% to be the username of the account. ea-php56 is the PHP version (PHP 5.6 here, ea-php70 and ea-php71 are also options) You do have to have MultiPHP enabled in the feature list that %user% is using. Which probably isn't a big ordeal, but say you don't want your user to be able to change their PHP version or you have a reseller that doesn't enable MultiPHP for one of their feature lists... then you are out of luck. You can set up a series of hooks to do this, but you have to do this for every account that is create, every subdomain that is created, and every addon domain that is created. You also have to remove all of this for every addon domain that is removed and every subdomain that is removed, otherwise you'll gum up the PHP-FPM configs and PHP-FPM won't restart. There may be another way of doing this that doesn't involved uapi. I'm not aware of it. You can set up your own PHP-FPM pools outside of MultiPHP (a roll your own setup) and accomplish this. But you're deviating outside of cPanel's realm if you do this.
    0
  • vacancy
    Thank you for the information. I understand that this is not going to be easy. We will expect Cpanel to produce a solution for this issue.
    It's not really that easy to do this. I agree with you that something needs to be done regarding this. But the way cPanel has this set up, it's just not that easy. You would have to do something like:
    /usr/local/cpanel/bin/whmapi1 php_set_vhost_versions version=ea-php56 php_fpm=1 vhost-0=%domain% /usr/local/cpanel/bin/uapi --user=%user% LangPHP php_set_vhost_versions vhost=%domain% version=ea-php56
    Adjusting %domain% to the be the domain name (or the subdomain, or the addon domain ... you have to do it for each one, which makes this method a bit cumbersome). %user% to be the username of the account. ea-php56 is the PHP version (PHP 5.6 here, ea-php70 and ea-php71 are also options) You do have to have MultiPHP enabled in the feature list that %user% is using. Which probably isn't a big ordeal, but say you don't want your user to be able to change their PHP version or you have a reseller that doesn't enable MultiPHP for one of their feature lists... then you are out of luck. You can set up a series of hooks to do this, but you have to do this for every account that is create, every subdomain that is created, and every addon domain that is created. You also have to remove all of this for every addon domain that is removed and every subdomain that is removed, otherwise you'll gum up the PHP-FPM configs and PHP-FPM won't restart. There may be another way of doing this that doesn't involved uapi. I'm not aware of it. You can set up your own PHP-FPM pools outside of MultiPHP (a roll your own setup) and accomplish this. But you're deviating outside of cPanel's realm if you do this.

    0
  • cPanelMichael
    Hello, There's a relevant feature request you may find useful at: PHP-FPM enabled by default on account creation Thank you.
    0
  • bejbi
    It's not really that easy to do this. I agree with you that something needs to be done regarding this. But the way cPanel has this set up, it's just not that easy. You would have to do something like:
    /usr/local/cpanel/bin/whmapi1 php_set_vhost_versions version=ea-php56 php_fpm=1 vhost-0=%domain% /usr/local/cpanel/bin/uapi --user=%user% LangPHP php_set_vhost_versions vhost=%domain% version=ea-php56
    Adjusting %domain% to the be the domain name (or the subdomain, or the addon domain ... you have to do it for each one, which makes this method a bit cumbersome). %user% to be the username of the account. ea-php56 is the PHP version (PHP 5.6 here, ea-php70 and ea-php71 are also options) You do have to have MultiPHP enabled in the feature list that %user% is using. Which probably isn't a big ordeal, but say you don't want your user to be able to change their PHP version or you have a reseller that doesn't enable MultiPHP for one of their feature lists... then you are out of luck. You can set up a series of hooks to do this, but you have to do this for every account that is create, every subdomain that is created, and every addon domain that is created. You also have to remove all of this for every addon domain that is removed and every subdomain that is removed, otherwise you'll gum up the PHP-FPM configs and PHP-FPM won't restart. There may be another way of doing this that doesn't involved uapi. I'm not aware of it. You can set up your own PHP-FPM pools outside of MultiPHP (a roll your own setup) and accomplish this. But you're deviating outside of cPanel's realm if you do this.

    Thank You. Do You know how to detect hanging PHP version by user ? It could be helpfull to make some king of trigger to set FPM automatically again using API as You wrote. Wojtek
    0
  • sparek-3
    Not that I know. The way I usually combat this is to enable all of the hook debugging: /usr/local/cpanel/bin/whmapi1 set_tweaksetting key=debughooks value=logall Then leave a running tail of the /usr/local/cpanel/logs/error_log tail -f /usr/local/cpanel/logs/error_log Then log into a cPanel and perform the action you are wanting to hook. Watch the tailing error_log to see if a hookable event comes up. Then write the hook for it. It helps if you can do this on a test server or at least a nonbusy server. The error_log is going to fill up pretty fast with all of this debugging information. You might be able to use just logdata instead of logall. logall is going to give a lot of information, but more information is generally what I am after. Turn off hook debugging with: /usr/local/cpanel/bin/whmapi1 set_tweaksetting key=debughooks value=0
    0

Please sign in to leave a comment.