简体   繁体   中英

setting up server on bluehost for laravel application and having issue with php -v

I am setting up a fresh server for laravel application. I have installed composer and chosen php5.6.15 from my cpanel. But when I run php -v command in terminal it shows my current version as php5.2.19.

Here is my php.ini file on my server it show 5.6 version

在此输入图像描述

I have uploaded my code to server using git. When I run command composer install it gives me this error.

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework v5.1.28 requires php >=5.5.9 -> your PHP version (5.4.43) or value of "config.platform.php" in composer.json does not satisfy that requirement.
    - laravel/framework v5.1.28 requires php >=5.5.9 -> your PHP version (5.4.43) or value of "config.platform.php" in composer.json does not satisfy that requirement.
    - Installation request for laravel/framework v5.1.28 -> satisfiable by laravel/framework[v5.1.28].

I am using laravel 5.1. If I downgrade it to 5.0 it gives dependency errors with other packages. Here is my composer.json file.

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.4.43",
        "laravel/framework": "5.1.*",
        "bestmomo/scafold": "dev-master",
        "illuminate/html": "5.*",
        "barryvdh/laravel-debugbar": "^2.0",
        "intervention/image": "^2.3",
        "doctrine/dbal": "^2.5",
        "davejamesmiller/laravel-breadcrumbs": "^3.0",
        "yajra/laravel-datatables-oracle": "^5.11",
        "zizaco/entrust": "dev-laravel-5"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist",
    }
}

I have php56 available under /usr/php/php56 and I can run it by making alias to it or just typing complete path. I also made an alias to it and after that php -v shows me 5.6.15 but when I run composer install it still gives the same above output.

I may be unable to set default version of php cli to 5.6 or it is something with laravel framework support on bluehost servers. I think bluehost support is less concerned because I have composer which can do rest piece of work. Your help to sort out this issue is very much appreciated.

You should execute it like the following:

/usr/php/php56 composer.phar

I have to do something similar at HostGator for composer to work.

To grab composer.phar just run php -r "readfile('https://getcomposer.org/installer');" | php php -r "readfile('https://getcomposer.org/installer');" | php php -r "readfile('https://getcomposer.org/installer');" | php .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM