PHP Switcher 5.0.0 - Error on compiling "need to specify operation before --basepath option

  • Hi Nuxwin,

    First of all thank you for the latest release of PHP Switcher.

    When compiling PHP versions with the following command line:

    1. perl /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/ --register --force-last --install-dir /opt/phpswitcher/%compDate% --runtime-dependencies --verbose --zts %phpVersions%

    I get an error "An error occurred while setup of PHP build environment: need to specify operation before --basepath option"

    with the following stack:

    What is wrong with --architecture amd64? How to solve this?

    With  --no-chroot it runs.

  • I get an error "An error occurred while setup of PHP build environment: need to specify operation before --basepath option"

    See also PHPSwitcher 5.0 - need to specify operation before --basepath option (duplicate report).

    What is wrong with --architecture amd64? How to solve this?

    What do you mean? Why do you think this has something to do with the architecture?


  • Starlight

    Found the cause... In older cowbuilder versions (as provided by Debian Jessie and Ubuntu Xenial Xerus repositories) the create command must be passed as an option style command, that is: --create instead of create... Similar problem should exist for the update command...

    This is due to change in cowbuilder... Option style command are not longer recommented but still supported by all versions so, I'll switch to option style command...

    Basically put:

    1. DIST=jessie ARCH=amd64 /usr/sbin/cowbuilder create --distribution jessie --architecture amd64 --basepath /var/cache/pbuilder/psw-debian-jessie.cow --configfile /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/pbuilder/Debian/.pbuilderrc --hookdir /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/pbuilder/Debian/hook.d

    will lead to:

    1. need to specify operation before --basepath option

    with older cowbuilder versions where commands were only passed as option style commands while:

    1. DIST=jessie ARCH=amd64 /usr/sbin/cowbuilder --create --distribution jessie --architecture amd64 --basepath /var/cache/pbuilder/psw-debian-jessie.cow --configfile /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/pbuilder/Debian/.pbuilderrc --hookdir /var/www/imscp/gui/plugins/PhpSwitcher/PhpCompiler/pbuilder/Debian/hook.d

    will work with any version, even through, option style command are not longer recommended in latest cowbuilder version:

    Sorry for the disagreement.


  • Starlight  Viktor

    Will be fixed in version 5.0.1 but for now:



  • Nuxwin

    Added the Label patched
  • After updating to 5.0.1 I got another error:

    Any idea?

    To re-run, I also need to clean up the build directory. Could be an improvement before starting the build process:

    1. rm -r /var/cache/pbuilder/psw-debian-jessie.cow/
  • Starlight

    I'll investigate for the errors. The cowbuilder version from Debian jessie and Ubuntu xenial seem to not work very good... The extra package as passed though the EXTRAPACKAGES variable from the .pbuilderrc configuraiton file are not taken into account (not installed) explaining the error.

    Regarding the cleanup, you should not have to do that. Doing this lead to full creation (debootstrap process) of the build environment each time your run the script while it should be created only once. The workflow is as follows:

    • Setup build environment
      • Already exist: update
      • Do not already exist: create
    • Build of a PHP version:
      • Install PHP build dependencies inside the chroot
      • Execute the MAKE(1) command inside the chroot

    Look at the script for more details.

    BTW: Next time please, create one thread per issue. Best would be to report those issues on github but we need first your github account to give you access to the private repository.


  • Starlight

    All issues reported in this thread were fixed in our git repository. The fixes will part of version 5.0.2.

    Thank you for your report.

    Thread closed.


  • Nuxwin

    Closed the thread.