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.
Related
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
This question already has an answer here:
Server composer install --no-dev killed
(1 answer)
Closed 2 years ago.
I am struggling to install Laravel on the AWS free tier Ubuntu instance. It gets stucks on the Composer installation due to a memory limit.
I initially ran the following commands:
sudo apt update && sudo apt upgrade
sudo apt install php7.2-common php7.2-cli php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-mbstring php7.2-bcmath php7.2-imap php7.2-xml php7.2-zip
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
composer --version
composer create-project --prefer-dist laravel/laravel my_app
I set the storage limit to 30gb in the instance. I tried to find a solution and everybody suggested to set the Composer limit to =-1. It still didn't resolve my issue.
I got this error when installing packages with Composer:
composer updating dependencies (including require-dev) killed
I tried to find the memory limit like this:
php -r "echo ini_get('memory_limit').PHP_EOL;"
It showed -1.
I also got this memory information:
It showed the memory limit as 128M. Is my issue due to this? If yes, then how can I increase the memory?
I just wanted to know that can we install Laravel with Composer on the free tier. I am not understanding everything clearly on this matter or is it any other configuration issue?
Yes, we can.
I verified that on AWS using t2.micro Ubuntu 18.04 with 30GB (don't need 30GB, but I used what you have).
For laravel installation, the following command was used:
composer global require laravel/installer
And also got memory error:
The following exception is caused by a lack of memory or swap, or not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details
In Process.php line 344:
proc_open(): fork failed - Cannot allocate memory
Based on the message, I added 1GB of swap by following these steps.
Once the swap was setup, I executed laravel installation command again and this time it worked.
I tested newly installed laravel by generating its standard blog project:
composer create-project --prefer-dist laravel/laravel blog
The command worked:
Installing laravel/laravel (v7.12.0)
- Installing laravel/laravel (v7.12.0): Loading from cache
Created project in blog
> #php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 92 installs, 0 updates, 0 removals
#
# not shown
#
Package manifest generated successfully.
> #php artisan key:generate --ansi
Application key set successfully.
Hope this helps.
p.s.
Installing php and various php extensions were also required.
Rob suggested this previously:
Download an existing composer.lock file from your git project. Then install Composer in same location. If you don't have a composer.lock file in your git repository, first push it to git from your development environment. Thanks Rob.
hi In Laravel Installation
The following error occurred
user#user-System-Product-Name:/$ composer global require "laravel/installer"
Changed current directory to /home/user/.config/composer
Using version ^2.0 for laravel/installer
./composer.json has been created
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
- laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- laravel/installer v2.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- Installation request for laravel/installer ^2.0 -> satisfiable by laravel/installer[v2.0.0, v2.0.1].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.1/cli/php.ini
- /etc/php/7.1/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.1/cli/conf.d/10-opcache.ini
- /etc/php/7.1/cli/conf.d/10-pdo.ini
- /etc/php/7.1/cli/conf.d/20-calendar.ini
- /etc/php/7.1/cli/conf.d/20-ctype.ini
- /etc/php/7.1/cli/conf.d/20-exif.ini
- /etc/php/7.1/cli/conf.d/20-fileinfo.ini
- /etc/php/7.1/cli/conf.d/20-ftp.ini
- /etc/php/7.1/cli/conf.d/20-gettext.ini
- /etc/php/7.1/cli/conf.d/20-iconv.ini
- /etc/php/7.1/cli/conf.d/20-json.ini
- /etc/php/7.1/cli/conf.d/20-mcrypt.ini
- /etc/php/7.1/cli/conf.d/20-mysqli.ini
- /etc/php/7.1/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.1/cli/conf.d/20-phar.ini
- /etc/php/7.1/cli/conf.d/20-posix.ini
- /etc/php/7.1/cli/conf.d/20-readline.ini
- /etc/php/7.1/cli/conf.d/20-shmop.ini
- /etc/php/7.1/cli/conf.d/20-sockets.ini
- /etc/php/7.1/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.1/cli/conf.d/20-sysvsem.ini
- /etc/php/7.1/cli/conf.d/20-sysvshm.ini
- /etc/php/7.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, deleting ./composer.json.
Installation failed, deleting ./composer.json.
I'm using the latest composer version...
php7 , mysql , apache2 already installed
Just need zip extension:
# For php v7.2
sudo apt-get install php7.2-zip
it says the requested PHP extension zip is missing from your system.
you have to enable or install that.
# For php v7.0
sudo apt-get install php7.0-zip
# For php v7.1
sudo apt-get install php7.1-zip
I worked by previously installing Composer, after php.
Run:
sudo apt-get install php7.2-zip
sudo apt-get install php7.2-curl
The only thing that helped me was updating my PHP to 7.4 with Brew.
brew install php#7.4
Nothing else worked for me.
if you use php 7.3
sudo apt-get install php7.3-curl
or simply if you are not sure with the version, just use code below
sudo apt-get install php7.2-curl
The only thing that helped me was install php-xml
sudo apt-get install php-xml
Hi I've been trying to make ansible run composer install to install all the content in my composer.json inside my laravel file. But I'm getting this error ERROR: composer is not a legal parameter in an Ansible task or handler I'm not sure what's causing this. Below are the content of my playbook.
---
- name: Install PHP5+
apt: name={{ item }} update_cache=yes state=latest
with_items:
- git
- mcrypt
- php5-cli
- php5-curl
- php5-fpm
- php5-intl
- php5-json
- php5-mcrypt
- php5-sqlite
- sqlite3
notify:
- Reload Nginx
- name: install composer
shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
args:
creates: /usr/local/bin/composer
- composer:
command: install
working_dir: /path/to/project
Now if I do vagrant provision I'm getting the Composer is not a legal parameter. Basically I just wanted to run composer and tell composer to install all dependency inside my composer json
http://docs.ansible.com/ansible/composer_module.html
I will usually just use a role from Ansible Galaxy, such as geerlingguy.composer for such requirements.
According to the Ansible Docs, the composer module is available from Ansible 1.6, but requires composer to be pre-installed on the executable path.
Installing Composer is usually going to be a multi-step process, if you use the installer (from the geerlingguy.composer tasks/main.yml).
Check if Composer is installed.
Download Composer installer (with Ansible get_url).
Run Composer installer (via PHP executable).
Move Composer into globally-accessible location.
Update Composer to latest version (if configured).
Ensure composer directory exists.
Add GitHub OAuth token for Composer (if configured).
Or, you can download the latest version, https://getcomposer.org/composer.phar or a tagged version make it executable and move it into an appropriate directory.
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