Syntax error in deep_copy.php

Hi @all
Today I installed the slim3-framework on my windows 10 pc (using composer), after installation I copied the folder structure to my web-server and updated index.php in the folder /public.

Now, if I test a POST-command I get the following error:
[Mon Sep 10 13:26:52.011523 2018] [fcgid:warn] [pid 2848] [client …] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected ‘function’ (T_FUNCTION), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR) in /var/www/…/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php on line 5

The source of the deep_copy.php is:

<?php namespace DeepCopy; use function function_exists; if (false === function_exists('DeepCopy\deep_copy')) { /** * Deep copies the given value. * * @param mixed $value * @param bool $useCloneMethod * * @return mixed */ function deep_copy($value, $useCloneMethod = false) { return (new DeepCopy($useCloneMethod))->copy($value); } } Did I miss anything during installation? Any help is highly appreciated. Thanks! Gerhard

You’re apparently using version 1 of the myclabs/DeepCopy library, which requires PHP/7.1, in a server that runs PHP/5.4.0 or PHP/5.5. Composer verifies the specs of the machine where you run it, then you upload the code to some other machine that doesn’t meet those specs.

You may want to find out the exact PHP version you have available and set it in your composer.json file as platform req:

    "config": {
        "platform": {
            "php": "5.5.35"

Beware that Slim/3 expects PHP/5.5 or greater thus won’t work on PHP/5.4

(Not fully sure how it all relates to Slim since DeepCopy does not seem to be a direct dependency.)

thanks kAlvaro,
you are absolutely right. on my PC i have PHP version 7, on the server I have 5.5

hi [gseebacher]… i got the same problem ? did you fix it ?