Laravel 5.2 | Issue with bootstrap/cache/compiled.php - php

Good afternoon,
I had a time with a problem running composer update in my production repository. Only in production, in DEV and PRE does not happen to me, everyone has the same configuration and at the end pull almost the same repository and share composer.json
I'm using "laravel / framework": "5.2. *", With PHP 7.0
The problem I have is that when launching composer update, I generate this file, bootstrap / cache / compiled.php but only in PROD, in neither of the other versions generates it, nor in local. With this file loaded the application gives an error 500 and reports this failure:
PHP Fatal error: Can not declare class Illuminate \ Support \ ServiceProvider, because the name is already in use in /var/www/vhosts/proyecto/bootstrap/cache/compiled.php on line 5267
If I delete this file by hand the application works again, but this should not happen, in addition, the applications that I try to install with composer, since I have this bug, do not work, I declare them in config / app.php and check that this The folder in vendor and everything is correct, but it gives another 500 so the reason why it does not erase or generate bootstrap / cache / compiled.php makes the installations do not end up being correct.
Please, could you help me, I do not know what else to look or do ....
This is my composer file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"twbs/bootstrap": "^3.3",
"laravelcollective/html": "5.2.*",
"joshcam/mysqli-database-class": "dev-master",
"opentok/opentok": "2.3.x",
"intervention/image": "^2.3",
"hisorange/browser-detect": "2.*",
"ignited/laravel-omnipay": "2.*",
"omnipay/omnipay": "*",
"skecskes/calendar": "0.2.*",
"webpatser/laravel-uuid": "^2.0",
"barryvdh/laravel-debugbar": "^2.2",
"maatwebsite/excel": "~2.1.0",
"paypal/rest-api-sdk-php": "*",
"laracasts/flash": "^2.0",
"doctrine/dbal": "^2.5",
"laravel/cashier": "~6.0",
"barryvdh/laravel-dompdf": "0.7.*",
"dompdf/dompdf": "^0.7",
"ovh/ovh": "^2.0",
"docusign/esign-client": "^2.0",
"sentry/sentry": "^1.6",
"sentry/sentry-laravel": "^0.7.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"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"
}
Thank you very much,
greetings

Update 2017/06/15 08:00 CEST
Remove, one by one the third party package from the require/requir_dev section and retry composer update
Mostly, third party packages cause this error. You can do the following things:
Run php artisan clear-compiled and retry composer update
Remove the generated service provider from compiled.php and retry composer update
Make a fresh installation
You're using PHP 7.0. It's not forbidden (I recommend) to use a newer version of Laravel!

Related

Composer stuck on `Something's changed, looking at all rules again` while updating laravel to 5.6

I am trying to update my Laravel application. I was at 5.2 and now I am at 5.5. Everything works fine till here.
Now I have changed it to 5.6.* in my composer file, and no matter how many times I run composer update, it gets stuck at
Something's changed, looking at all rules again (pass #142)
Doesn't matter how many passes I let it go on for.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.5.*",
"laravelcollective/html": "5.5.*",
"jenssegers/agent": "^2.6",
"doctrine/dbal": "v2.5.5",
"guzzlehttp/guzzle": "~6.0",
"laravel/cashier": "~6.0",
"spatie/laravel-backup":"^3.0.0",
"maatwebsite/excel": "~2.1.0",
"rap2hpoutre/laravel-log-viewer":"0.8.0",
"arcanedev/log-viewer": "4.2.*",
"tymon/jwt-auth": "0.5.*",
"aws/aws-sdk-php-laravel": "3.1.0",
"league/flysystem-aws-s3-v3": "~1.0.0",
"tecnickcom/tcpdf": "^6.2",
"ip2location/ip2location-laravel": "^1.0",
"geoip2/geoip2":"~2",
"maxmind-db/reader": "~1.0",
"pusher/pusher-php-server": "~3.0",
"maknz/slack-laravel": "^1.0",
"laravel/tinker": "1.0.10"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"filp/whoops": "~2.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/helpers.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist"
}
}
Initially there was an issue with a third party package https://github.com/spatie/laravel-backup which was causing issues but I have tried removing it as well. Still same issue. :(
I tried removing on dependancy at a time and updating
"laravel/cashier": "~6.0"
This one was causing the issue. Changed it to ~7.0 and now it works fine.
Any one else having this issue, just try to remove all dependancies and try installing them one at a time, and most probably you will find the culprit, then you can try updating that one seperately.
For me the culprit was phpspec/phpspec, which seems like it is no longer needed from Laravel 5.2 onwards.
if you install this extension "nesbot/carbon": "^2.17",Just upgrade him
It may need more passes.
I do not know what it is doing, but for me it continued at 980 passes.
Some dependencies are not compatible after we upgrade the version of Laravel. So, we must upgrade the version of some dependencies. This upgrade is clearly outlined in the Laravel documentation.
(https://laravel.com/docs/5.3/upgrade)

why composer update causes laravel app to fail on redirects

I have a laravel app (version 5.5) that I have been developing for months.
For the longest time I could add new libraries in my composer.json file and run "composer update" so it would build a new composer.lock file and everything worked just fine. But now when ever I run composer update and I restart my laravel app, any thing I do which would cause the site to attempt a "redirect" (such as login or logout) produces the following error:
Type error: Argument 1 passed to Laravel\Lumen\Http\Redirector::__construct() must be an instance of Laravel\Lumen\Application, instance of Illuminate\Foundation\Application given, called in ... (depends on where I am doing a redirect)
so I am sure this must be caused by some package not properly updating. So if I simply delete the entire ..\vendor folder and then run composer install, it will fix the issue. Site will run fine for months then if I run composer update again the error comes back. So I know it is being caused by one of the packages being included. Does anyone know what to do to try to figure out what, or how or which package is causing this error?
In case you need it here is a copy of the composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"anhskohbo/no-captcha": "^2.3",
"askedio/laravel5-soft-cascade": "^5.5",
"aws/aws-sdk-php": "^3.25",
"aws/aws-sdk-php-laravel": "^3.1",
"doctrine/dbal": "^2.5",
"intervention/image": "^2.3",
"laravel/framework": "5.5.*",
"laravel/socialite": "^3.0",
"laravel/tinker": "~1.0",
"laravolt/avatar": "^1.8",
"league/flysystem-aws-s3-v3": "^1.0",
"pbmedia/laravel-ffmpeg": "^1.1",
"php-ffmpeg/php-ffmpeg": "^0.9.5",
"sammyk/laravel-facebook-sdk": "^3.5",
"braintree/braintree_php" : "3.27.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0",
"filp/whoops": "~2.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Http/helpers.php"
]
},
"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"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
===============================================
Updated: To be clear I have searched my code for Laravel\Lumen and I find no references but when I search the \vendor folder I get several packages including Amazon AWS which does reference that (see below).... But how do I fix those packages?
Laravel\Lumen theres your answer. How come Lumen is being used?
Somewhere in your code you're importing the wrong class. The exception is stating that a Illuminate\Foundation\Application is being created, which is correct, but somewhere there is a type hint expecting Laravel\Lumen\Application. Do a search through your code for Laravel\Lumen\Application and you'll probably find the problem.

PHP Composer lock file interoperability between Windows and Linux

Is it safe to create a composer lock file in Windows, use that lock file in a server that runs on Linux (Centos 6.8 to be exact) and expect the same installed packages/functionality as long as PHP versions match between the 2? My current dev environment actually relies on Docker with containers that mimic our production server but I run into an issue if I use Composer on it. While it works fine, trying to get Laravel Dusk (an automated browser testing framework by the Laravel developers) to work headless in an acceptable manner on my Centos setup is a frustrating task. But that's a problem better fit as a separate question.
In comparison, it works fine on my host/Windows but I would have to run Composer there instead to generate the necessary bin .bat files since Dusk needs to make calls to /path/to/composer/bin/phpunit.bat on a Windows environment.
The following is how my composer file looks like (basically close to stock with some extra libraries)
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"guzzlehttp/guzzle": "~6.0",
"laravelcollective/html": "^5.3",
"imagine/imagine": "~0.5.0",
"predis/predis": "~1.0",
"dompdf/dompdf": "^0.7.0",
"laravel/dusk": "^1.0",
"laravel/browser-kit-testing": "^1.0",
"santigarcor/laratrust": "3.0.*",
"laravel/passport": "^2.0",
"dingo/api": "1.0.*#dev"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"barryvdh/laravel-ide-helper": "^2.2",
"deployer/deployer": "^4.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"Tests\\": "tests/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/BrowserKitTest.php"
]
},
"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"
}
}

vendor class not found in laravel

I use unisharp file manager in my project. on my local machine everything works fine, but on remote server it throws error [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider' not found
in config/app.php everything's correct
/*FileMananger*/
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
/*CKEditor*/
Unisharp\Ckeditor\ServiceProvider::class,
there is directory unisharp in vedor(so all files and directories are there). when i try to run composer install/update i get this error again. so everything in its right place, but laravel doesn't see this class.
comoser.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"maatwebsite/excel": "~2.1.0",
"appzcoder/crud-generator": "^1.2",
"laravelcollective/html": "^5.3",
"lavary/laravel-menu": "dev-master",
"nesbot/carbon": "^1.21",
"laracasts/flash": "^2.0",
"spatie/laravel-medialibrary": "^3.11",
"firebase/php-jwt": "^4.0",
"doctrine/dbal": "^2.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Http/helpers.php"
]
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"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"
}
}
Try to comment those lines in config/app.php and run composer require unisharp/laravel-filemanager again.
You can't set up service providers before they are downloaded through composer.
You need to run:
composer require unisharp/laravel-filemanager
Make sure your config/app.php unisharp providers is matched with the content in folder vendor unisharp composer.json
check below:
Config/app.php
vendor/unisharp-composer.json
the solution is very easy :)
just make sure you have this in your service provider:
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
not this one:
UniSharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,

Installation of package.json

i am unable to install this library from GitHub. [Minishlink/web-push]
I have Laravel 5 installed on my server, I want to install this in the Laravel directory (project). And will use the library via custom PHP.
I am facing below issues:
When I run composer require minishlink/web-push, I get below error:
When I run composer require mdanter/eec, I get below error
When I run composer require pargonie/rndom_compat, I get below error
Here is the composer.json file (I have not included the web-push file here as I am using the require command via putty, [Please correct me if I'm wrong])
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"guzzlehttp/guzzle": "~4.0",
"maatwebsite/excel": "~2.0.0",
"aloha/twilio": "^2.0",
"laravel/socialite": "2.0.*",
"ixudra/curl": "6.*",
"laracasts/utilities": "^2.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"laracasts/utilities": "~2.0"
},
"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"
}
}
This is the same type of issue as #17. It's not related to Minishlink/web-push. One of your dependancies is stuck in the past with paragonie/random_compat v1.1.5. You should check which one and ask the owner to update the composer.json. To fix this temporarily, in your composer.json, on your dev machine put:
"paragonie/random_compat": "dev-master as 1.1.5",
"minishlink/web-push": "^1.1"

Categories