Home > Enterprise >  Downgrade my php version in laravel project
Downgrade my php version in laravel project

Time:06-17

I'm trying to upload my laravel projecto to 000webserver but I'm getting this error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2".

Does anybody know how can I downgrade my php version without losing functionality? Do I need to downgrade my laravel version? Find attached my composer.json code:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "apalfrey/select2-bootstrap-5-theme": "^1.3",
        "doctrine/dbal": "^3.3",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.11",
        "laravel/sanctum": "^2.14.1",
        "laravel/tinker": "^2.7",
        "sendinblue/api-v3-sdk": "8.2.1",
        "subfission/cas": "^4.2"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

CodePudding user response:

if you have laravel 9 project, then there is no way to just change php version because php8 is minimum requirement for laravel 9, in other case you can simply change php version in composer.json like "php": "^7.4", and run composer update

note that changing php version can lead to errors if you've used some php8 specific features that was added or changed since earlier php versions

CodePudding user response:

You can use laragon and switch between versions of php easily

  • Related