1

I'm on Ubuntu 16.04.6 LTS + Plesk 17.8.11 with several PHP versions installed (7.0, 7.1 and 7.2) Even if I set the following line in the .bashrc file:

alias php='/opt/plesk/php/7.2/bin/php'

I check (with php -v) that the current PHP version actually is 7.2

BUT when I run the line :

composer create-project symfony/website-skeleton my-project

I still have Symfony 3.4 instead of 4.x

:(

Here is the the composer.json file after the "composer create-project symfony/website-skeleton myproject " command line:

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.0.8",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "sensio/framework-extra-bundle": "^5.1",
        "symfony/asset": "3.4.*",
        "symfony/console": "3.4.*",
        "symfony/dotenv": "3.4.*",
        "symfony/expression-language": "3.4.*",
        "symfony/flex": "^1.1",
        "symfony/form": "3.4.*",
        "symfony/framework-bundle": "3.4.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/orm-pack": "*",
        "symfony/process": "3.4.*",
        "symfony/security-bundle": "3.4.*",
        "symfony/serializer-pack": "*",
        "symfony/swiftmailer-bundle": "^3.1",
        "symfony/translation": "3.4.*",
        "symfony/twig-bundle": "3.4.*",
        "symfony/validator": "3.4.*",
        "symfony/web-link": "3.4.*",
        "symfony/yaml": "3.4.*"
    },
    "require-dev": {
        "symfony/debug-pack": "*",
        "symfony/maker-bundle": "^1.0",
        "symfony/profiler-pack": "*",
        "symfony/test-pack": "*",
        "symfony/web-server-bundle": "3.4.*"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "3.4.*"
        }
    }
}
yolenoyer
  • 8,797
  • 2
  • 27
  • 61
Pulsar
  • 91
  • 1
  • 1
  • 4
  • please insert composer.json file in the Question – A. El-zahaby Mar 09 '19 at 22:55
  • Try composer create-project symfony/website-skeleton my-project 4.2 – Sindhara Mar 09 '19 at 22:55
  • Maybe try installing composer again? Maybe composer was installed as a different user and somehow still has a path to an older php version? Seems unlikely. Just guessing. – Cerad Mar 09 '19 at 23:40
  • Hi. If I use "composer create-project symfony/website-skeleton myproject 4.2" I get the error message : "[InvalidArgumentException] Could not find package symfony/website-skeleton with version 4.2." – Pulsar Mar 10 '19 at 07:32

1 Answers1

0

Here is the solution tat works for me : Since Composer will always use the default PHP version on the server, create an alias : alias composer='/opt/plesk/php/7.2/bin/php /usr/lib/plesk-9.0/composer.phar' and then Composer will install Symfony 4.x !

Pulsar
  • 91
  • 1
  • 1
  • 4