I've been asked on my job to update a Laravel 6 project to version 9. I'm having a lot of issues, i can't even test the project cause it's giving me a lot of errors.
First i wanted to check the exact laravel version (i've been told it's 6.2), but I can't even check it with php artisan --version or use php artisan...
Also I would like to know how to do the update, since i can only find enough information to update from 8 to 9 on the official website.
Thanks.
Things i've tried:
-Changed this on composer.json:
"require": {
"php": "^7.3|^8.0",
.....
},
-Tried this composer commands:
composer update
composer install
composer update --no-scripts
composer require laravel/framework
-I get this errors:
During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with Arr
ayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\Users*******\
Documents\Project\project\vendor\laravel\framework\src\Illuminate\Support\Collection.php:1277
or
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Thanks.
I've been able to upgrade laravel 6 to 7 with success.
The first problem was that my PHP version was too high, apparently higher versions does not work for the upgrade, so I had to downgrade PHP (im using Xampp so i just had to change 'apache' and 'php' folders on Xampp folder from 7.2.5 version).
My project had some external dependencies that I had to upgrade first before running 'composer update'. This was the main problem and I didn't know about that. (In my case barryvdh/laravel-ide-helper and laravel/ui).
After I fixed that things, I just ran 'composer update' and everything was working. I'll try to upgrade now to laravel 8 and 9, hope it's the same. Thanks to everyone for the answers and hope this can help others.
Related
My host updated composer version ( 2.2 ) without updating php version ( 7.0.33 ).
When I run composer [command], I get this error:
Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 7.0.33-0+deb9u12, please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.
I don't have the option to downgrade composer (composer self-update --2.2 give me the same ) and this php version is locked.
So I decided to use /opt/plesk/php/7.4/bin/php /usr/lib/plesk-9.0/composer.phar [command] instead and it works. I think php /usr/lib/plesk-9.0/composer.phar will work too.
I'm using Symfony 4 and now I need to deploy my application. But when I try php bin/console doctrine:schema:update --dump-sql composer detect issues because my dependencies require a higher php version than defined in var
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5". You are running 7.0.33-0+deb9u12. in /var/www/vhosts/client-name/httpdocs/vendor/composer/platform_check.php on line 24
First question: Why composer is called when I try to update my database using doctrine CLI?
What I tried
I run composer config platform.php 7.0.33
Some of my dependencies are now too new, so I'm trying to downgrade them to the latest major version.
I changed the version of PHP and in libraries in the "require" section and I run /opt/plesk/php/7.4/bin/php /usr/lib/plesk-9.0/composer.phar update --with-dependencies ( because just composer cause me problems )
It doesn't work for doctrine which need PHP 7.1 and I don't want to go back to doctrine 1 ( doctrine 2.0 was released in 2010 )
Second question: Do you have any suggestion? I don't see an immediate solution
I had the same issue and I had to upgrade PHP by running:
$ brew unlink php#7.1
$ brew link php#8.1
Hope that can help someone.
If you have the same problem than me, you may need to call symfony command using PHP binaries directly:
/opt/plesk/php/7.4/bin/php bin/console d:s:u --dump-sql
This question already has an answer here:
How to handle missing dependencies with composer & docker?
(1 answer)
Closed 1 year ago.
When I want to see my Laravel project in localhost, I get the following error message.
Composer detected issues in your platform: Your Composer dependencies
require a PHP version ">= 8.0.2".
My terminal PHP version is 8.0.2, and my MAMP PHP version is 8.0 (no higher version is available, it has always worked like this). I don't know what else to do. I have already put my composer.json and .lock files at 8.0.2 PHP.
You can use the following to install/update commands if you have an invalid PHP version or are missing a PHP extension.
composer update --ignore-platform-reqs
I have been writing laravel code for quite sometime. Currently, I tried cloning a project from github and editing locally. I installed composer in my project directory but a vendor folder was not included, I tried to run composer install but I gives me this error
Your lock file does not contain a compatible set of packages. Please run composer update
How do I resolve this?
Note: I have tried running composer update on previous clones and that didn't work.
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Disclaimer, this solution will not fix the issue for PHP 8 projects.
In most cases this happens because of PHP 8 (In my case it was GitHub CI actions automatically started using PHP 8 even though my project is php 7.4)
If you have multiple PHP installations (E.g. 7.4 and 8 on the same server), this is how you can fix it.
Specify your php version in your composer.json file
"config": {
"platform": {
"php": "7.3"
}
},
If you have the lock file already committed, run composer update after you adding above line in to the composer.json and then commit the new lock file. (Please be aware composer update will upgrade your packages to latest versions)
I solved this problem with this command:
composer self-update --1
It probably works because at time that the project was developed, composer was on another version and when change the Major version from 1 to 2 the compatibility was broke. With this command you downgrade composer and probably going to solve this
You should try running composer update --lock that will update all packages and recreate the compose.lock file.
Either you can delete the composer.lock file and run composer install that will also recreate the .lock file.
This resolved my issue.
I had this error with Github Actions trying to deploy a Laravel app, this is probably different than the OP's case but none of the suggestions worked for me. Adding my answer here just in case there is someone else out there with a similar problem to mine.
I had to disable -q in Github Actions and see that it was complaining about extensions not being installed.
Make sure your require section of composer's php extensions matches the extensions: in your github action file for shivammathur/setup-php#v2 and it will deploy again
Recently I've just come across of this error when I tried to run my Laravel 7 project which required php v7.* with php v8. As I forgot my php version I just tried bunch of composer command, but just got error after error.
Anyway, to solve this just downgrade/upgrade php version as required. Just search how to do that in youtube.
you can see your project required php version in composer.json file (just if you wonder)
Also you can try following way (But though it didn't worked for me, seems it helped quite some people)
-- Open composer.json file and change php version to something like this: "php": "^7.3|^8.1"
-- Then run composer update
I faced this problem with my cakephp project in garuda linux (arch based)
Fix :
Install php-intl using sudo pacman -S php-intl
Enable php intl by editing php config ( in my case /etc/php/php.ini ) .
add extension=intl or uncomment the existing one
restart apache or whatever you are using
I had the same error deploying another project with composer, but the problem was a missing php extension.
I understand you solve your problem but for anyone seeing the same error message, here is a general guidance :
The error message Your lock file does not contain a compatible set of packages. Please run composer update is shown each time there is a conflict during the dependency solving step of composer install. (see the relevant part in composer source code)
It doesn't inform on the real problem though, and it could be hard to guess.
To get the exact explanation you can add --verbose option to composer install command (the option is available to any composer command (see the doc)) : composer install --verbose
It will give you the full message explaining what exactly is preventing composer install from completing (package version conflict, missing php extension, etc.), then you'll be able to fix the problem.
Hope this could help.
In my case this problem is occuring in Ubuntu 20.04 Desktop. This is due to some missing packages.
I ran the following commands to install some packages then rerun Composer install and its working properly. The commands are:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
Then rerun composer install
I have Laravel 5.4 installed on PHP 5.6.4 server, and i can't start the app. Everything works ok locally with the same configuration, but on the server i get this error:
(1/1) FatalErrorException syntax error, unexpected '?', expecting variable (T_VARIABLE)
in PDOConnection.php line 24
CLI version is 7.2 on the server, and phpinfo() shows 5.6.40. The error shows on pages where DB access is needed. When there's no DB requests it works fine.
Thanks :)
PDOConnection.php is a file from doctrine/dbal package, and its line 24 is incompatible with PHP 5.4 (using ?array).
Laravel 5.4 has doctrine/dbal~2.5 in its require-dev, but in version 2.5 there is no such issue (line 40).
It seems that you have to delete vendor folder and run composer install again, that will install needed dependencies.
Added:
#aynber pointed that your issue is with installing dependencies with PHP 7.2 and running on PHP 5.6, so after removing vendor folder and before reinstalling you should add this to your composer.json:
"config": {
"platform": {
"php": "5.6.40"
}
}
Source
Are you sure you're using Laravel 5.4? Laravel 5.4 should be using doctrine/dbal#~2.5 where there is only a comment on line 24. It appears you are using at least version 2.9, which uses nullable types which is only available in PHP 7.1+.
Your options:
Update your PHP version
Remove and reinstall laravel/framework#5.4
Thanks for your help, i fixed the problem.
I cleared the composer cache with 'composer clearcache', then i ran:
composer which, which returned the composer path
and then i ran
php -d allow_url_fopen=on COMPOSER_PATH_FROM_PREV_STEP update
and it updated all dependencies to work with PHP5.6 :)
I just updated my Laravel 5.4.23 to 5.5 and tried running my tests for PHPUnit and I am receiving the following error and I am trying to scour around the internet and find out people who have done so and have received the same error message but have not had any luck.
Has anyone received this error?
Call to undefined method Whoops\Handle\PrettyPageHandler::setApplicationPaths()
setApplicationPaths() doesn't exist in the 2.0.0 release of the filp/whoops library. Essentially, it's not a problem with Laravel 5.5 but with that specific version of Whoops. I experienced the same issue until I updated the library version I was using to the newest stable version of Whoops (2.1.10), which I did by changing the dependency version in my composer.json file "filp/whoops" : "~2.1.10" Once you make that change, run composer update and the error should go away.
(1/5/2018) Editing to add that this doesn't appear to be an issue in later releases of Laravel 5.5, so changes to the version of filp/whoops should not be necessary at this point.
Have you tried clearing all the caches via php artisan cache:clear or php artisan view:clear?