Friday, March 10, 2017

PHP version is not the same

I had a problem with this code

class Crop
{
    const TYPE = ['main_crop', 'detail_crop', 'common_crop', 'list_crop'];
}

var_dump(Crop::TYPE);

Problem was that my PHP version was below 5.6 I managed to fix it by upgrading it.

So php -i is giving me PHP Version => 7.0.16-4+deb.sury.org~trusty+1.

Now I have a server running. Using phpinfo() I am getting back PHP Version 5.5.9-1ubuntu4.21, and because of it my code from above is not working.

I am using Laravel and using commands composer upgrade, composer install are not installing new php version. It doesn't matter what version I put in "php":"xxx".

composer.json :

{
    "name": "laravel/lumen",
    "description": "The Laravel Lumen Framework.",
    "keywords": ["framework", "laravel", "lumen"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.0",
        "laravel/lumen-framework": "5.2.*",
        "vlucas/phpdotenv": "~2.2",
        "venturecraft/revisionable": "^1.27",
         "doctrine/dbal": "^2.5",
        "nicolaslopezj/searchable": "^1.9",
        "sofa/eloquence": "^5.2",
        "intervention/image": "^2.3",
        "ivanlemeshev/laravel5-cyrillic-slug": "^1.0",
        "guzzlehttp/guzzle": "~6.0",
        "sngrl/sphinxsearch": "dev-master",
        "graylog2/gelf-php": "^1.5"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "phpunit/phpunit": "~4.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/Helpers/Helper.php"
        ]
    },
    "autoload-dev": {
        "classmap": [
            "tests/",
            "database/"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ]
    }
}

What am I doing wrong?



via user3350597

Advertisement