Laminas getstart error - multiple php version environment

Hi all,
On my centos 7 server 1, only install php71 , Composer version 1.6.5

php -v
PHP 7.1.27 (cli) (built: Mar 6 2019 08:53:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

I can run sucesfully
php /usr/local/bin/composer create-project laminas-api-tools/api-tools-skeleton

Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package zfcampus/zf-console is abandoned, you should avoid using it. No replacement was suggested.
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Package zfcampus/zf-deploy is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files

laminas-development-mode enable
You are now in development mode.

On my server 2 , multiple php version installed : 5.4 (default) , 7.0 , 7.1 , 7.2 , Composer version 1.10.9 (build by php7.1)

/opt/rh/rh-php71/root/bin/php -v
PHP 7.1.30 (cli) (built: Nov 4 2019 10:07:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.30, Copyright (c) 1999-2018, by Zend Technologies

The command fail
/opt/rh/rh-php71/root/bin/php /usr/local/bin/composer create-project laminas-api-tools/api-tools-skeleton

Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package zfcampus/zf-console is abandoned, you should avoid using it. No replacement was suggested.
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Package zfcampus/zf-deploy is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
19 packages you are using are looking for funding.
Use the composer fund command to find out more!
Do you want to remove the existing VCS (.git, .svn…) history? [Y,n]? n

laminas-development-mode enable
PHP Parse error: syntax error, unexpected ‘function’ (T_FUNCTION), expecting identifier (T_STRING) or \ (T_NS_SEPARATOR) in /root/api-tools-skeleton/vendor/laminas/laminas-zendframework-bridge/src/Autoloader.php on line 15
Script laminas-development-mode enable handling the development-enable event returned with error code 255
Script @development-enable was called via post-create-project-cmd

How can I fix it ?

The development mode is enabled after the new project is created. I guess the default PHP installation (version 5.4) is used in this case. “use function” is available since 5.6, so this won’t work.

You should be able to en-/disable the development mode by choosing any of your PHP 7 installations manually: /opt/rh/rh-php71/root/bin/php /usr/local/bin/composer run-script development-enable

If you need to run multiple applications with different PHP requirements, you should have a look at Docker :wink:

Regards,
Marco