When I run
docker run --rm -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest composer install
to install all the composer dependencies,
these popped up
~/Crowdstage$ docker run --rm -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- spatie/image is locked to version 2.2.2 and an update of this package was not requested.
- spatie/image 2.2.2 requires ext-exif * -> it is missing from your system. Install or enable PHP's exif extension.
Problem 2
- spatie/laravel-medialibrary is locked to version 10.3.4 and an update of this package was not requested.
- spatie/laravel-medialibrary 10.3.4 requires ext-exif * -> it is missing from your system. Install or enable PHP's exif extension.
To enable extensions, verify that they are enabled in your .ini files:
-
- /usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
- /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
- /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
What is the proper way to set up PHP environment in docker for laravel ?
If I understand correctly, you want to run composer install inside the php container. You can do this by running
docker-compose exec laravel.test "composer install"
if laravel.test is the container name
This is how you can install composer dependencies in a cloned project
docker run --rm -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest composer install --ignore-platform-reqs
Related
Sail Version: 1.16.2
Laravel Version: 9.37
PHP Version: 8.1
Host operating system: macOS 12.3
Description:
I want to use Sail on my existing Laravel application.
As following to the documentation, i need to execute this command to install sail & other composer dependencies:
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs
When i run it, everything is going well until composer install crashes with this error:
Install of google/apiclient-services failed
In Filesystem.php line 314: Could not delete /var/www/html/vendor/composer/cc83f9bf/googleapis-google-api-php-client-services-52b4942/src/OrgPolicyAPI:
Steps To Reproduce:
Install new laravel application
Delete vendor folder if you have one
Add "google/apiclient": "^2.12.6" to your composer.json
Execute the docker run command above
Error occurs
Can someone help me solving this?
Most people in my team doesn't need dev dependencies. So it is desirable that composer install doesn't install dev dependencies.
However, QA does need to install them with some command.
I have no idea how to achieve this now. Formerly it was composer install --dev but that's gone.
You can set the environment variable COMPOSER_NO_DEV to 0 or 1 to change the default behaviour of composer install and composer update.
see: documentation - COMPOSER_NO_DEV
If you want composer install to not install the dev dependencies by default
export COMPOSER_NO_DEV=1
If you want composer install to install dev dependencies (the default)
export COMPOSER_NO_DEV=0
or unset COMPOSER_NO_DEV
Depending on how you develop (i.e. in a container) there are various options to set a default value for the environment variable.
On the other hand you can instruct your engineer colleagues that do not require any dev dependencies to run the command:
composer install --no-dev
# .. or ..
COMPOSER_NO_DEV=1 composer install
... instead of ...
composer install
# .. or ..
COMPOSER_NO_DEV=0 composer install
I am new to Laravel. I want to composer install the code but I get the error. Does anyone know how to solve it?
Problem 1
- Root composer.json requires php-mime-mail-parser/php-mime-mail-parser ^7.0 -> satisfiable by php-mime-mail-parser/php-mime-mail-parser[7.0.0].
- php-mime-mail-parser/php-mime-mail-parser 7.0.0 requires ext-mailparse * -> it is missing from your system. Install or enable PHP's mailparse extension.
To enable extensions, verify that they are enabled in your .ini files:
- D:\wamp64\bin\php\php7.3.21\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
The mailparse extension does not yet support PHP 7.3 or 7.4.
You need change your PHP version
https://serverpilot.io/docs/how-to-install-the-php-mailparse-extension/
Install Mailparse on PHP 7.0, 7.1, or 7.2
To install this extension on PHP 7.X, SSH in to your server as root and run the following commands:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo pecl7.X-sp install --nodeps mailparse
sudo bash -c "echo extension=mailparse.so > /etc/php7.X-sp/conf.d/mailparse.ini"
sudo service php7.X-fpm-sp restart
I'm running the following commands in Travis CI for my build:
before_install:
- curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
script:
- sudo composer -nqq update
I'm installing composer manually as I want to use sudo with it, as it's installed only for the user.
The error which I'm having are:
Updating dependencies (including require-dev)
- Installing jakub-onderka/php-console-color (0.1)
Downloading: Connecting... Failed to download jakub-onderka/php-console-color from dist: The "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1" file could not be downloaded (HTTP/1.1 403 Forbidden)
Now trying to download from source
- Installing symfony/yaml (v2.7.4)
Downloading: Connecting... Failed to download symfony/yaml from dist: The "https://api.github.com/repos/symfony/Yaml/zipball/2dc7b06c065df96cc686c66da2705e5e18aef661" file could not be downloaded (HTTP/1.1 403 Forbidden)
Now trying to download from source
I've tried these links and they work fine.
Does it mean Travis is blocking GitHub API for some reason? If not, how do I fix it?
By fix, I mean either to know what's going on, or suppress these error messages (e.g. by using some special parameter in composer or changes to JSON file to force downloads from the source).
My composer.json file is:
{
"config": {
"vendor-dir": "/var/lib/vendor",
"bin-dir": "/usr/local/bin"
},
"require": {
"drush/drush": "dev-master"
}
}
For the reference, the full .travis.yml looks like:
before_install:
- env
- curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
- sudo apt-get -qy update
install:
- sudo apt-get install vagrant
script:
- set -e # This makes build to fail on first error.
- sudo composer -nqq update
- make
- make vm
after_failure:
- sudo apt-get -qy install tree && - tree -d -L 6 # Print directory structure in the form of a tree.
- env
sudo: true
language: php
python:
- "5.5"
Most probable reason for the error is limited amount of downloads from github. What you need to do is create a token in your github account and add it globally to your composer with
composer config -g github-oauth.github.com <your-token>
Source: https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
My suggestions are:
Remove:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo composer -nqq update
First line: not needed, because Composer is pre-installed, when you use language: php.
Second line: its better to execute composer install, because update uses the data from composer.lock if your repo contains one. And sudo is not needed here.
(Sidenote on the usage of sudo on Travis-CI:
sudo is only available in the non-containainer based infrastructure. I don't know if you really need this, but maybe you could switch to the faster container based infrastrucutre by setting sudo: false in your travis.yml, see http://docs.travis-ci.com/user/workers/container-based-infrastructure/ . Just a hint.)
Add to travis.yml
before_install:
- composer self-update
- composer install --no-interaction --optimize-autoloader
First line: update the (possibly) outdated composer of this Travis instance.
Second line: install dependencies described in composer.json with Composer.
The additional parameters to switch between downloading "Dist" or downloading "Source" are --prefer-dist and --prefer-source.
So its either
- composer install --prefer-dist --no-interaction --optimize-autoloader
or
- composer install --prefer-source --no-interaction --optimize-autoloader
Does it mean Travis is blocking GitHub API for some reason?
If its not a temporary issue, then its seems your Composer is running into the Github API rate-limit. The GitHub API allows only a low number of requests for unauthenticated users. You can raise the API limit by authenticating at Github from Travis.
See FAQ: https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
Please try it with prefer-source first.
I installed composer while trying to install cakePhp, but the installation was not successful and I want to uninstall composer.
I am not finding any way to do this.
For the installation I used the command curl -s https://getcomposer.org/installer | php
I am working in linux
During the installation you got a message
Composer successfully installed to: ... this indicates where Composer was installed. But you might also search for the file composer.phar on your system.
Then simply:
Delete the file composer.phar.
Delete the Cache Folder:
Linux: /home/<user>/.composer
Windows: C:\Users\<username>\AppData\Roaming\Composer
That's it.
Uninstall composer
To remove just composer package itself from Ubuntu 16.04 (Xenial Xerus) execute on terminal:
sudo apt-get remove composer
Uninstall composer and it's dependent packages
To remove the composer package and any other dependant package which are no longer needed from Ubuntu Xenial.
sudo apt-get remove --auto-remove composer
Purging composer
If you also want to delete configuration and/or data files of composer from Ubuntu Xenial then this will work:
sudo apt-get purge composer
To delete configuration and/or data files of composer and it's dependencies from Ubuntu Xenial then execute:
sudo apt-get purge --auto-remove composer
https://www.howtoinstall.co/en/ubuntu/xenial/composer?action=remove
Additional information about removing/uninstalling composer
Answers above did not help me, but what did help me is removing:
~/.cache/composer
~/.local/share/composer
~/.config/composer
Hope this helps.
If you install the composer as global on Ubuntu, you just need to find the composer location.
Use command
type composer
or
where composer
For Mac users, use command:
which composer
and then just remove the folder using rm command.
curl -sS https://getcomposer.org/installer | sudo php
sudo mv composer.phar /usr/local/bin/composer
export PATH="$HOME/.composer/vendor/bin:$PATH"
If you have installed by this way simply
Delete composer.phar from where you've putted it.
In this case path will be /usr/local/bin/composer
Run this command
sudo rm /usr/local/bin/composer/composer.phar
Note: There is no need to delete the exported path.
Find the Location of the Composer by typing this command
whereis composer
Then You will get the output like this
composer: /usr/local/bin/composer
then cd /usr/local/bin/
then remove composer by this command
sudo rm -r composer