Docker compose php version lower than actual - php

I'm trying to do docker-compose up -d --build and thereĀ“s a part where I get the errors
RUN composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction:
#0 0.785 Installing dependencies from lock file
#0 0.787 Verifying lock file contents can be installed on current platform.
#0 0.802 Your lock file does not contain a compatible set of packages. Please run composer update.
#0 0.802
#0 0.802 Problem 1
#0 0.802 - doctrine/lexer is locked to version 3.0.0 and an update of this package was not requested.
#0 0.802 - doctrine/lexer 3.0.0 requires php ^8.1 -> your php version (8.0.6) does not satisfy that requirement.
but when I do php --version I have version 8.2.0 and when I run Apache I get the same result, version 8.2.0.
I've tried basically everything I've found online but nothing seems to fix the issue.
Am I doing something wrong?
Thanks alot for your time :)

The problem is not in the docker itself, during the initialization of the instance it tries to run a composer install and finds a discrepancy between the content of the composer.lock and its instance.
In its place, initially I would try to delete this composer.lock file, if that doesn't solve it, the ideal would be to check the Dockerfile and check the PHP version and the scripts it runs, maybe even add a flag --ignore-platform- reqs on composer install

Related

Error : Composer require symfony/web-server-bundle

I tried to execute a symfony project within a docker container by "php bin/console server:run " but it generate the following error :
"There are no commands defined in the "server" namespace.
You may be looking for a command provided by the "Debug Bundle" which
is currently not installed. Try running "composer require
symfony/debug-bundle --dev". ]"
Then i tried to install this package, but the error persist .
And i tried to install symfony/web-server-bundle package too, but another error display:
"Composer require symfony/web-server-bundle Info from
https://repo.packagist.org: #StandWithUkraine ./composer.json has been
updated Running composer update symfony/web-server-bundle Loading
composer repositories with package information Updating dependencies
Your requirements could not be resolved to an installable set of
packages. Problem 1
- Root composer.json requires symfony/web-server-bundle 6.1.*, found symfony/web-server-bundle[v3.3.0-BETA1, ..., 3.4.x-dev,
v4.0.0-BETA1, ..., 4.4.x-dev] but it does not match the constraint.
Installation failed, reverting ./composer.json and ./composer.lock to
their original content "
The symfony/web-server-bundle is now deprecated.
For a dev environment, you can try installing the Symfony cli https://symfony.com/download. I don't know what docker image you are using, but the doc has instructions for installation on multiple different linux environments.
Then you can use the Symfony local server: https://symfony.com/doc/current/setup/symfony_server.html.
Typically the command to run the server is:
symfony server:start
A side note: when using docker you will also need to expose the port the web server runs the application on if you want to access it.

Laravel command not found. But it is added to my $PATH on Ubuntu

So I know there are alot of simmular issues but none if them are exactly the same,
I want to start my first laravel project but, my terminal tells me command not found,
I installed composer from the website and when I run composer I can see that it works perfectally with no issue, when running composer global require "laravel/installer" I get this in response :
Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.2 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
This tells me that laravel is indeed installed but has not updates but when I run command laravel the response is laravel: command not found,
I have added composer to my $PATH already.
This is why I am posting this issue because all the posts I find says to add composer to your $PATH but mine is already but its still a issue.
PHP is also installed on my machine
I am running linux Ubuntu 22.04 LTS
I'll write the answer here so you can close the question. As #geertjanknapen said in the comment if you can install your project the run
composer create-project laravel/laravel your-app-name
cd /your-app-name
php artisan serve
You must have a local server running also, once you have run php artisan serve then just go to http://127.0.0.1:8000/ and you'll see Laravel's home screen. (NOTE 8000 is the default port, so put yours there if you've changed it).

Having trouble adding the Wikibase extension to a MediaWiki Install

I am trying to set up a new MediaWiki 1.35 install and add the Wikibase extension. The install is running on a Debian 10 LXC container hosted on proxmox.
I have been following the Wikibase/Installation MediaWiki guide but I seem to be stuck. When I get to the 'Run Maintenance Scripts' step and try to run php update.php it thows the following error:
[10e7e1e19b828fdfd6418545] [no req] Error from line 47 of /var/lib/mediawiki/extensions/Wikibase/lib/WikibaseLib.entitytypes.php: Class 'Wikibase\DataModel\Entity\ItemId' not found
Backtrace:
#0 /var/lib/mediawiki/extensions/Wikibase/client/includes/WikibaseClient.php(532): require()
#1 /var/lib/mediawiki/extensions/Wikibase/client/includes/WikibaseClient.php(748): Wikibase\Client\WikibaseClient::getDefaultEntityTypes()
#2 /var/lib/mediawiki/extensions/Wikibase/client/includes/WikibaseClient.php(796): Wikibase\Client\WikibaseClient::newInstance()
#3 /var/lib/mediawiki/extensions/Wikibase/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php(64): Wikibase\Client\WikibaseClient::getDefaultInstance()
#4 /var/lib/mediawiki/includes/installer/DatabaseUpdater.php(554): Wikibase\Client\Usage\Sql\SqlUsageTrackerSchemaUpdater::fillUsageTable(MysqlUpdater)
#5 /var/lib/mediawiki/includes/installer/DatabaseUpdater.php(522): DatabaseUpdater->runUpdates(array, boolean)
#6 /var/lib/mediawiki/maintenance/update.php(181): DatabaseUpdater->doUpdates(array)
#7 /var/lib/mediawiki/maintenance/doMaintenance.php(107): UpdateMediaWiki->execute()
#8 /var/lib/mediawiki/maintenance/update.php(253): require_once(string)
#9 {main}
I made sure to clone the proper version of Wikibase (REL1_35). I've looked everywhere for a solution but it seems like I have messed up in a unique way. I should also mention that is my first time setting up a MediaWiki server so any help is greatly appreciated.
I made a git and uploaded everything in the root of the MediaWiki install: https://github.com/ggosset2017/MediaWiki-Install.git
Update:
Looks like it's a problem with some dependency. I did make sure to install composer and install dependencies following the WIkibase guide linked above. I used the following commands/file edits.
First, I updated the composer.local.json file in the root of MediaWiki install to match the following:
{
"extra": {
"merge-plugin": {
"include": [
"extensions/Wikibase/composer.json"
]
}
},
"require": {
"monolog/monolog": "~2.0.2"
}
}
sshed into the container and ran the following.
rm composer.lock
composer install --no-dev
Everything seemed to download fine and the only error I got was the following:
Warning from https://repo.package.org: you are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
I expected this error as MediaWiki does not support composer 2, at least according to this: https://www.mediawiki.org/wiki/Composer#Installing_Composer
Update 2:
Looks like my composer.local.jason file was somehow changed to composer.local.jason-sample. I have removed the -sample appended to that file name. Now composer is throwing the following error when I try to run rm composer.lock and composer install --no-dev
image of composer error
In Solver.php line 243:
Problem 1
- The requested package monolog/monolog ~2.0.2 exists as monolog/monolog[1.25.5] but these are rejected by your constraint.

'errno=5 Input/output error' occurred while run composer update in laravel7.9.2 project

I'm trying to do composer update in a laravel project in my local system, but caught this error:
errno=5 input/output error
~ compoeser update
Loading composer repositories with package information
Updating dependencies (including require-dev)
[ErrorException]
hash_file(): read of 8192 bytes failed with errno=5 Input/output error
It's happening after installing the php-intl extension.
I completely reinstall php and all its extensions in my system, but the problem not solved.
also, I reinstall the composer and install another new laravel but neither solved the problem.
OS: Ubuntu 18.04.4 LTS 64bit
php: 7.4.5
laravel: 7.9.2
Just run this
rm -rf ~/.composer/cache
or for more debugging info
Composer install/update not working
The Verified Answer is your solution...
In case you run that in a VM, try adding RAM. I found that my Vagrantbox defaulted to 512MB. After setting it to 2048 via .Vagrantfile it worked.

Composer crashes when it tries to Resolve dependencies

I am trying to use Composer to install dependancies inside a Docker container running PHP 5.6.40.
It runs, but quits and the vendor directory is always empty.
MacBook:my-app dev$ docker exec my-app_php56_1 php -d memory_limit=-1 composer.phar update -vvv --no-cache --no-plugins
Disabling cache usage
Running 1.9.0 (2019-08-02 20:55:32) with PHP 5.6.40 on Linux / 4.9.184-linuxkit
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/html): git branch --no-color --no-abbrev -v
Reading /root/.composer/composer.json
Loading config file /root/.composer/composer.json
Loading composer repositories with package information
Downloading https://repo.packagist.org/packages.json
Updating dependencies (including require-dev)
Downloading http://repo.packagist.org/p/provider-2013%24b962a943715f142bd3c36c0e87b67b28b16c014a98898622ec735220b7e1ee4f.json
Downloading http://repo.packagist.org/p/provider-2014%24ecc1513d9762efcfd48fdbaf4a08f829a59093064f40b7c351f93f3fbdd07973.json
Downloading http://repo.packagist.org/p/provider-2015%24258303eff7165b17439353fe44e501a3a6d600bd5b5482c5261a2ffa2234a947.json
Downloading http://repo.packagist.org/p/provider-2016%2496e2313b5ba90c2b798b03f9e306a27c15f11f763cd6478b834943fc128fc111.json
Downloading http://repo.packagist.org/p/provider-2017%24d2ad294ebaf381b7bf68cacbe514cf2bb33c3a919b97319bfa2e2ffaa66bc511.json
Downloading http://repo.packagist.org/p/provider-2018%2466893d07acdb18bb12d5e92e062b6e3058f5d284292b09cf585bf0ceb1b26aca.json
Downloading http://repo.packagist.org/p/provider-2018-10%24ff53e18093ae3e52a84c5567489c78bf1d82d0af80f413c3d6ad35d541a28434.json
Downloading http://repo.packagist.org/p/provider-2019-01%2431194ef7551ee4bffd7cc09dd6d01dc60848afc129544438ac7931e9d42dd54e.json
...
Downloading http://repo.packagist.org/p/phpspec/phpspec%248dc959bd0ae544f84e5bceee933d9a61d0a2074b208c3b7e7807cdc320e83eee.json
Downloading http://repo.packagist.org/p/phpspec/php-diff%249b8687b7c99f069823a9ac8d17900f9c8243368ceea9a5ac4e71ab424bb6f2d5.json
Downloading http://repo.packagist.org/p/squizlabs/php_codesniffer%24386b3726c6c3ce5edde180a7881f924be5dfd720c951dc93db8455ae871e9d61.json
MacBook:my-app dev$
It then just returns nothing and the vendor directory remains empty.
I am running composer without any plugins or cache.
Finally, the exact same composer.json file works fine in my other PHP 7.1.x container.
I also wondered if the final dependancies was causing an issue so tried removing it. Still no luck.
EDIT:
I've now gone back to my PHP 7.1 container and run the exact same scripts and it works fine. Composer's output is (so the 5.6 version just dies at the point that it does the "Resolving dependencies through SAT":
...
Downloading http://repo.packagist.org/p/webmozart/assert%24f23cf2d90bee4a1a09dc1d005896d60e715bdb9ecd4531874bfc3dd3ea5908c1.json
Downloading http://repo.packagist.org/p/phpspec/phpspec%248dc959bd0ae544f84e5bceee933d9a61d0a2074b208c3b7e7807cdc320e83eee.json
Downloading http://repo.packagist.org/p/phpspec/php-diff%249b8687b7c99f069823a9ac8d17900f9c8243368ceea9a5ac4e71ab424bb6f2d5.json
Downloading http://repo.packagist.org/p/squizlabs/php_codesniffer%24386b3726c6c3ce5edde180a7881f924be5dfd720c951dc93db8455ae871e9d61.json
Resolving dependencies through SAT
Looking at all rules.
Something\'s changed, looking at all rules again (pass #16)
Dependency resolution completed in 28.879 seconds
Analyzed 21713 packages to resolve dependencies
Analyzed 1376894 rules to resolve dependencies
Resolving dependencies through SAT
Looking at all rules.
Dependency resolution completed in 0.003 seconds
Package operations: 116 installs, 0 updates, 0 removals
Installs: kylekatarnls/update-helper:1.2.0, stripe/stripe-php:v2.3.0, abraham/twitteroauth:0.6.6, ralouphie/getallheaders:3.0.3, psr/http-message:1.0.1, guzzlehttp/psr7:1.6.1, guzzlehttp/promises:v1.3.1, guzzlehttp/guzzle:6.0.2, maknz/slack:1.7.0, maknz/slack-laravel:1.0.0, sabberworm/php-css-parser:8.1.0, phenx/php-svg-lib:v0.3.2, phenx/php-font-lib:0.5.1, dompdf/dompdf:v0.8.3, vlucas/phpdotenv:v1.1.1
...
etc for everything else
From the output of your run, it seems your composer setup is using http rather than https. Run this command before installing composer:
composer config -g repo.packagist composer https://packagist.org
This question is getting a little old now so I assume you already resolved it. I had the same problem recently.
The problem appears to stem from the change of PHP version. In my case I was going from 7.1 to 7.2, which you would imagine shouldn't cause too much of an issue.
My composer update -vvv --no-cache --no-plugins output would show
Resolving dependencies through SAT
Looking at all rules.
Something's changed, looking at all rules again (pass #[forever increasing])
After attempting to install symfony/thanks
In the end I had to remove symfony/thanks from my composer.json and run again. It then gave me some problems with a few other packages that I also removed. Once I had a successful run I was then able to start adding the offending packages back to my composer.json and eventually the issue was resolved.
I assume the underlying issue was a number of conflicts in the various levels of dependencies of my packages.
I guess if anyone finds they end up removing more and more packages, the solution would be to start from the minimum possible packages (the default Laravel composer.json in my case) and start adding new packages one-by-one.

Categories