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

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.

Related

composer global require fails where non global equivalent succeeds

Im developing a package available at packagist as user/package. Installing it locally works just fine
composer require user/package
Creating a new project is also fine
composer create-project --prefer-dist user/package new-project
But the package is to be deployed globally
composer global require user/package
however this results in the following error log.
Changed current directory to /home/anders/.composer ./composer.json
has been updated Loading composer repositories with package
information Updating dependencies (including require-dev) Your
requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for user/package ^v0.0.3 -> satisfiable by user/package[v0.0.3].
- Conclusion: remove illuminate/container v5.5.2
- Conclusion: don't install illuminate/container v5.5.2
- don't install tightenco/collect v5.4.33|don't install laravel/framework v5.5.2
- don't install laravel/framework v5.5.2|remove tightenco/collect v5.4.33
- Installation request for illuminate/container (installed at v5.5.2) -> satisfiable by illuminate/container[v5.5.2],
laravel/framework[v5.5.2].
- Installation request for tightenco/collect (installed at v5.4.33) -> satisfiable by tightenco/collect[v5.4.33].
Installation failed, reverting ./composer.json to its original
content.
How can this be?
I have tried composer global clearcache
Deleted a composer.lock file I found directly under /home/anders/.composer/
Upgraded my dependencies (Laravel) from 5.5.x to 5.6.x with no effect
Even creating a fresh "laravel new blog" project and uploading to packagist fails with the same error message.
Here is my composer.json
{
"name": "user/package",
"description": "Package",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"ajthinking/tinx": "^2.1",
"fideloper/proxy": "~3.3",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"bin": [
"package"
]
}
Would really appreciate help interpreting the error log. Thanks!
Update
This is the content of /home/anders/.composer/
{
"require": {
"cpriego/valet-linux": "^2.0",
"laravel/installer": "^1.4",
"phpunit/phpunit": "^6.4",
"phpunit/dbunit": "^3.0"
}
}
Composer version: 1.6.5
If this is standalone tool, you should consider building PHAR for it. You can use kherge/box to simplify build process.
PHAR archive is completely standalone, so you'll get rid of all problems with conflicting global dependencies. It may also simplify installation (you need to just download archive and make it executable) for both global and local installation.

i can not install laravel passport

composer require laravel/passport ^v1
result command
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.22) does not satisfy that requirement.
- Installation request for doctrine/instantiator (installed at 1.1.0) -> satisfiable by doctrine/instantiator[1.1.0].
Installation failed, reverting ./composer.json to its original content.
my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.22",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravel/passport": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
how can i solved it
Install php 7.1 and you will be fine.
For ubuntu
https://www.vultr.com/docs/how-to-install-and-configure-php-70-or-php-71-on-ubuntu-16-04
For windows
http://php.net/manual/en/install.windows.php
You have to update your php version to be 7, after that you have to re install your composer and make sure that it will take correct php version

Laravel 5.2 Heroku Deployment Failed to install system packages

I am trying to deploy Laravel 5.2 project to heroku but I am getting the following error
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
! ERROR: Failed to install system packages.
Your platform requirements (for runtimes and extensions) could
not be resolved to an installable set of dependencies, or a
repository was unreachable.
Full error information from installation attempt:
> Loading repositories with available runtimes and extensions
>
> Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
> Nothing to install or update
> Generating autoload files
Please verify that all requirements for runtime versions in
'composer.lock' are compatible with the list below, and ensure
all required extensions are available for the desired runtimes.
For reference, the following runtimes are currently available:
PHP: 7.1.10, 7.1.9, 7.1.8, 7.1.3, 7.1.2, 7.1.1, 7.0.24,
7.0.23, 7.0.22, 7.0.17, 7.0.16, 7.0.15, 5.6.31, 5.6.30,
5.5.38
HHVM: 3.5.1
For a list of supported runtimes & extensions on Heroku, please
refer to: https://devcenter.heroku.com/articles/php-support
! Push rejected, failed to compile PHP app.
! Push failed
This is my composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"barryvdh/laravel-ide-helper": "^2.1",
"components/jquery": "2.1.4",
"components/jqueryui": "1.11.4",
"kodeine/laravel-acl": "^0.1.3",
"laravelcollective/html": "5.2.*"
},
"require-dev": {
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": "~3.0",
"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 ran have tried to deploy about a couple of dozens time after using composer install, composer update, composer update --lock and I even deleted the composer.lock file and ran composer update again but this error is not going anywhere. Please help!
It turned out that my vendor folder was not listed in .gitignore files and it was being pushed along with the other files on heroku. Once I added the vendor folder to .gitignore everything started working seamlessly.

Deployment on Laravel Forge throwing faker not found Exception

I am trying to deploy a laravel project on forge and i am getting the below exception :
Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Faker\Factory' not found
I have the faker reference in require-dev in composer.json!
composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"tymon/jwt-auth": "0.5.*",
"dingo/api": "1.0.x#dev"
},
"require-dev": {
"fzaninotto/faker": "~1.5",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"laracasts/testdummy": "1.*",
"laracasts/generators": "^1.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"
}
}
Deployment script in Forge:
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force
php artisan db:seed --class="StaticDataSeeder"
I was able to deploy the same project locally with out any problem and composer update on forge also runs successfully and i can see the faker package getting downloaded.
Please let me know if i am missing something.
There is a clear conflict that explains your problem:
You've added the "fzaninotto/faker" package to the require-dev section.
You're running the deployment composer install command with the --no-dev option which explicitly prohibits installing the packages listed in require-dev.
So the solution is either to move the package to the require section or remove the --no-dev option when deploying.
I have same problem on heroku deployment i think it same, i fix with
moving "fzaninotto/faker": "~1.4" from "require-dev" to "require" in composer.json and composer.lock
composer install
composer update
git add
git commit
git push heroku
if you don't use heroku as deployment don't run from step 4-6
Run the next command:
composer install
And the problem should go away

Laravel Installation:Pacakge is not found even if php version is greater than 5

I have installed laravel framework via git using this composer create-project laravel/laravel --prefer-dist command.But i will get the following error
Problem 1
- laravel/framework v5.0.4 requires php >=5.4.0 -> no matching package found
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
My php version is 5.6.3 i have referred some questions related to my problem but didn't help me.
CMPOSER.JSON
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*"
},
"require-dev": {
"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"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
It looks like the command line is using an old PHP version (5.3.28).
Unix
In a LAMP environment run whereis php to see where the PHP binary is located and delete it.
Windows
In windows it's a bit trickier. You can search for the PHP installation(s) manually or try to figure it out using the PATH variable (type PATH in the console)
Then try to run php -v again. Hopefully it should now use the newer version.

Categories