Posts by axl

    Problem B - exists since 5.0.3 and still in 5.0.5:

    When switching a site back to the default phpversion or when creating a new customer with default phpversion, the same problem from above now hits all pages wich are using the default php version. The command perl /var/www/imscp/engine/imscp-rqst-mngr -v is not able to fix this problem, but with a fast reconfiguration perl /var/www/imscp/engine/setup/imscp-reconfigure -danv this problem gets hotfixed aswell in the meantime. But it seems like there is still another problem hidden in the phpswitcher.

    Spent some time trying to work on this, and found a probable cause and a fix for it. I could not cause the default PHP version pool configurations to be deleted on a domain creation or deletion. However, there is a bug related to the php_compiler.pl, which causes all the pool configurations to be wiped for the default PHP version.


    The issue


    When using the compiler, all the PHP versions processed get changed to either toadd or tochange state. Then, run-method on backend/PhpSwitcher.pm will run _deconfigureFpm for all the affected PHP versions.


    On the very last line of _deconfigureFpm, there is a function call:

    unlink grep !/www\.conf$/, glob "$phpVersion->{'version_fpm_pool_directory_path'}/*.conf"; This will delete all the pool configs besides the www.conf. This is fine for PHP versions other than default. run will then call _scheduleDomainsChange, which will change the status of domains, subdomains, aliasses and subdomain aliasses to tochange if they have a non-default PHP-version. When the backend tasks are run, the pool configurations get recreated for these.


    So, in summary, all PHP versions will have their pool configurations deleted, but only the ones with non-default PHP-version gets recreated. Because the default PHP service is not reloaded, the issue will not be visible until someone adds a domain or changes back to default PHP version.


    The solution


    The fix seems to be quite simple. You have to edit backend/PhpSwitcher.pm and change the end (should be line 1787) of _deconfigureFpm from

    Code
    1. unlink grep !/www\.conf$/, glob "$phpVersion->{'version_fpm_pool_directory_path'}/*.conf";

    to

    Code
    1. # Prevent default PHP file configurations from being destroyed
    2. return if $phpVersion->{'version_is_default'};
    3. unlink grep !/www\.conf$/, glob "$phpVersion->{'version_fpm_pool_directory_path'}/*.conf";

    Disclaimer: use at your own risk.


    Additional help


    If you managed to end up in a state where all the pool configurations for default PHP versions are gone, there is a faster alternative to perl /var/www/imscp/engine/setup/imscp-reconfigure -danv. Basically, you need to change the state of domains, subdomains, aliasses and subdomain aliasses with default PHP version to tochange, and run the request manager with /var/www/imscp/engine/imscp-rqst-mngr or from admin via Debugger -> Run Tasks. To change all the states, you can run these SQL queries:

    Disclaimer: use at your own risk.