I have windows 07 64-bit OS and I have downloaded the composer as well as I am running wampserver wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-x64.exe . I have tried to install PHPUnit using composer but couldn't. I found the installation steps on linux/ mac os but not in windows. Some site suggested to add a dependency on phpunit/phpunit to the php project's composer.json file. But how? I don't know.
Please help me for the installation of PHPUnit using composer on wampserver(windows 07-64 bit OS) or any alternatives..
You do the exact same thing you would do on Linux or OSX.
As from the docs over at: http://www.phpunit.de/manual/current/en/installation.html#installation.composer.
{
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
}
and run php composer.phar install --dev.
For a system wide install you do:
{
"name": "phpunit",
"description": "PHPUnit",
"require": {
"phpunit/phpunit": "3.7.*"
},
"config": {
"bin-dir": "C:/my/dir"
}
}
and add the directory to your windows $PATH.
In this case I would suggest to use Pear. Usually you don't install just couple of php classes but also you might need to configure Windows to make phpunit running as tool.
Try to have a look here
Related
composer install with file compose.json
{
"require-dev": {
"phalcon/devtools": "~3.4"
}
}
should install Phalcon Dev-Tools.
Actual Behavior
Instead, it breaks with error
Your requirements could not be resolved to an installable set of packages.
Problem 1
Installation request for phalcon/devtools ~3.4 -> satisfiable by phalcon/devtools[v3.4.0].
phalcon/devtools v3.4.0 requires ext-phalcon ~3.3 -> the requested PHP extension phalcon is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
/Applications/MAMP/bin/php/php7.2.1/conf/php.ini You can also run php --ini inside a terminal to see which files are used by PHP in CLI mode.
Details
MacOS 10.13.5,
MAMP 4, PHP 7.2.1
php_phalcon.so 3.4 is copied into the extension directory and inserted into php.ini from php-phalcon-mamp
proof:
php -m
phalcon
....
how to force update composer ignoring the dependencies?
I figured it out by running the below command.
composer update --ignore-platform-reqs
composer install --ignore-platform-reqs
I have installed composer on my Synology NAS using this tutorial. I did use PHP73 instead of PHP70 because the package I would like to install requires a minimum of PHP72. It all seems to run fine until I run the following command:
composer require duncan3dc/sonos
This gives me the following error:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "duncan3dc/sonos" is not defined.
I have already removed composer and reinstalled but without success, so currently my application requiring the package is broken. Very strange because it ran fine before and I don't see where I made changes that could be causing this.
Pretty new at composer btw. I'm running composer 2.0.7 btw.
Solved this by adding the following to my composer.json file and thus forcing composer to use a different version of PHP:
"config": {
"platform": {
"php": "7.3"
}
}
Sometimes when I run composer update to upgrade the laravel project, a content-length mismatch exception might occur.
Finally, I get this is because of the terrible firewall in China: the DNS was poisoned.
So, if you are like me, could there be a way to fix it out?
First, run:
composer config --list --global //this will get the composer home path.
[home] /root/.composer //it's my composer home path.
And then, edit the config.json, make it like this:
{
"config": {
"github-protocols": [
"https"
]
},
"repositories": {
"packagist.org": {
"type": "composer",
"url": "https://packagist.org"
}
}
}
It will make the packagist connection force https.
And also you could config the composer.json in your project, this is a laravel sample would be look like:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*"
},
"config": {
"preferred-install": "dist"
},
"repositories": {
"packagist.org": {
"type": "composer",
"url": "https://packagist.org"
}
}
}
Update
Before Composer v1.2.3 the repository key for packagist was "packagist". In v1.2.3 it was changed to "packagist.org" (see commit e38ebef).
Just change the composer default repo url:
composer config -g repo.packagist composer https://packagist.org
composer config -g github-protocols https ssh
It changes or sets the packagist repo to be used by https only.
This fixes any issues with local composer.json files too.
No need to mess around with the composer.json file localy or global.
I tried accepted answer and it was not working for me, and I tried answer from macbert and same issue, Also tried uninstall and install fresh composer. Anyway thanks to macbert and Alex Chiang I figured another solution.
I think the problem is my composer cannot download data from packagist.org server, so I changed server into a mirror. Run following command on cmd to change into mirror (I got this mirror from here)
composer config -g repo.packagist composer https://repo-eu-uk-1.packagist.org
If this is not working for you try some other mirror from https://packagist.org/mirrors
Anyway I listed down the same list here even if you cannot load the above link
Africa, South Africa
composer config -g repos.packagist composer https://packagist.co.za
Asia, China
composer config -g repos.packagist composer https://mirrors.huaweicloud.com/repository/php
Asia, China
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
Asia, China
composer config -g repos.packagist composer https://php.cnpkg.org
Asia, China
composer config -g repo.packagist composer https://packagist.phpcomposer.com
Asia, China
composer config -g repos.packagist composer https://packagist.mirrors.sjtug.sjtu.edu.cn
Asia, China
composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/
Asia, India
composer config -g repo.packagist composer packagist.in
Asia, India
composer config -g repos.packagist composer https://packagist.in
Asia, Indonesia
composer config -g repos.packagist composer https://packagist.vrkansagara.in
Asia, Japan
composer config -g repos.packagist composer https://packagist.jp
Asia, South Korea
composer config -g repos.packagist composer https://packagist.kr
Asia, Thailand
composer config -g repos.packagist composer https://packagist.mycools.in.th/
South America, Brazil
composer config -g repos.packagist composer https://packagist.com.br
NOTE: I didn't try all the mirrors, you may try one by one if it is not working for you.
I had the same issue so I came here though google search.
I run composer commands both on my local machine and docker machine. I received a variety of errors on each machine when running composer install including Composer Content-Length Mismatch.
I started to mess with my composer.json file as recommended, then I realized the macbook lost it's wifi connection, like it loves to do. Additionally I am on a poor network as I am traveling. I also was warned my composer was out of date on my local machine, which I should have been using my docker VM to issue the commands anyway. My docker workspace container had not been updated for a year.
I got the wifi connection back, upgraded composer on my local machine and composer install ran just fine. I assume if I upgrade docker config that it will work there as well.
composer config -g repos.packagist composer https://packagist.jp
I had the same issue, i did two things
first updated composer, it was 1.4 updated to 1.7
secondly, change internet connection to high speed.
I had the same problem while installing laravel on my Windows machine, I was using git bash for running following command.
composer global require "laravel/installer=~1.1"
I switched to the normal command prompt then it worked without any errors.
Had some same issues based from the Github source you may also use
composer self-update --snapshot
this might produce this:
but after that it will automatically proceed and download
Solved the same issue by simply upgrading zlib(1g) [deb]
(more precisely, from trusty/14.04 to xenial/16.04, both are LTS of course ;-)
Laravel Error Content Length mismatch Solution
Only Need to run some commands
I know that's an old one, but I faced this issue for the first today.
I'm not sure if the answer here is partially helping or not, but I keep getting the same errors anyway.
The difference (though, again, it might be just a coincidence) is that further attempts seems to be partially successful:
- The already downloaded JSON are retrieved from the cache (I don't dare clearing the cache now)
- Some of previously failed ones are downloaded with success
- Other are still failing
I suppose that if I keep trying, I'll eventually manage to download all the JSON files.
It's clear that the problem is that Composer is unable to download the complete file (which is indeed quite big).
I don't think is a network issue from my side: as far as I can see, it works just fine as it always did.
What I don't understand is what changed from yesterday that makes Composer behaves like that: I didn't update Composer, PHP or other things.
Also, even supposing that I'll eventually manage to let Composer download all these huge files, the first time I'll clear the cache, I'll likely face the same problem again.
I wonder if, at least in my case, the problem is elsewhere, because all the answer I could find are pointing here and everyone seems to solve the problem: no more errors and quick downloads of these JSON files (which is not my case).
I was about to install laravel 4 but accidentally installed laravel 5 instead, now I need to remove 5 and install 4, I tried to change in the composer the line that says: require: "laravel/framework": "5.1.", and overwrite it by "laravel/framework": "4.2.", but when I create a new project it still creates it in laravel 5 unless I point to version 4 with the creation command, any help?
Go into your composer.json folder, and edit
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*" << change this to 4.2
"torann/laravel-asana": "0.2.*#dev",
"asana/asana": "^0.1.2"
},
then run composer dump-autoload and then try to run composer update.
when you use the composer command you can specify which version you want to install you can do that like :
composer create-project laravel/laravel=4.2 yourdirectoryname
there... I also faced a similar problem when trying to do my mini project. In order to clear the old Laravel application installed Just delete the laravel. bat as shown in my screenshot. You also need to clear the cache memory
like
php artisan cache:clear
This will get rid of the laravel and your system is ready for a fresh installation.
I am trying to use composer.json file. but, when I am trying to run command 'composer install' in my path/project/, I am getting an error:
I have already configured my wamp for 'extension=php_intl.dll' and copied all icu*.dll in 'D:\wamp\bin\apache\apache2.2.22\bin' from 'D:\wamp\bin\php\php5.3.13' and it's showing in phpinfo():
without copy icu*.dll also works and showing in phpinfo();
Kindly, let me know if I have intl install on my wamp and composer install on my pc then why I am getting this error. really, it is so annoying.
Here is my details:
OS: windows 7 (64)
PHP: 5.3.13
Apache:2.2.22
Composer: installed by executable file
Pear: installed (latest)
PHPUnit: installed (latest)
My composer.json is as below:
{
"name" : "sebastian/money",
"description" : "Value Object that represents a monetary value (using a currency's smallest unit)",
"keywords" : ["money"],
"homepage" : "http://www.github.com/sebastianbergmann/money",
"license" : "BSD-3-Clause",
"authors" : [{
"name" : "Sebastian Bergmann",
"email" : "sebastian#phpunit.de"
}
],
"require" : {
"php" : ">=5.3.3",
"ext-intl" : "*"
},
"require-dev" : {
"phpunit/phpunit" : "~4.0"
},
"autoload" : {
"classmap" : [
"src/"
]
},
"extra" : {
"branch-alias" : {
"dev-master" : "1.3.x-dev"
}
}
}
Let me know if any other details is required..
Any feedback/help would be highly appreciated.
I encountered this using it in Mac, resolved it by using --ignore-platform-reqs option.
composer install --ignore-platform-reqs
After installing with this method, if the package that defines the requirement attempts to use any functions from the specified PHP extension, it will fail irrevocably.
PHP uses a different php.ini for command line php than for the web/apache php. So you see the intl extension in phpinfo() in the browser, but if you run php -m in the command line you might see that the list of extensions there does not include intl.
You can check using php -i on top of the output it should tell you where the ini file is loaded from. Make sure you enable the intl extension in that ini file and you should be good to go.
For php.ini 5.6 version (check version using php -v)
;extension=php_intl.dll
; remove semicolon
extension=php_intl.dll
For php.ini 7.* version
;extension=intl
; remove semicolon
extension=intl
In linux (Debian Jessie for example):
apt-get install php7.0-intl
will make the job to you due will create a simbolic link to it.
To enable intl extension follow the instructions below.
You need enable extension by uncommenting the following line extension=php_intl.dll in the C:\xampp\php\php.ini file.
Once you uncomment the extension=php_intl.dll, then you must restart apache server using XAMPP control panel.
//about line 998
;extension=php_intl.dll
change as
extension=php_intl.dll
(Note: php.ini file mostly in the following directory C:\xampp\php)
Restart xampp
just remove them
"ext-intl" : "*"
from your composer.json file.
Because sometimes for some helper functions, the IDE complains that the extension is missing from the composer.json file. Immediately press Alt+Enter to add it to the composer. But that doesn't mean that composer will count them in. The composer will complain next time while doing some operations. So that, we should not blindly type Alt+Enter rather than installing them manually in composer by doing composer install <package-name>.
As I think you have entered it manually, you should remove it, then install it in proper procedure composer install <package-name>
Or else you can run composer update to count that added dependencies in.
If You have got this error while running composer install command,
don't worry.
Steps to be followed and requirements:
Step1: Go to server folder such as xampp(or) wampp etc.
Step2: open php folder inside that and go to ext folder.
Step3: If you find a file named as php_intl.dll no problem.
Just go to php.ini file and uncomment the line
From:
;extension=php_intl.dll
To:
extension=php_intl.dll
Step4: restart xampp, thats it
Note: If you don't find any of the file named as
php_intl.dll, then you need to upgrade the PHP version.
(with xampp server)open php.ini in ".\xampp\php"
change ;extension=intl to extension=intl
This is bit old question but I had faced same problem on linux base server while installing magento 2.
When I am firing composer update or composer install command from my magento root dir. Its was firing below error.
Problem 1
- The requested PHP extension ext-intl * is missing from your system. Install or enable PHP's intl extension.
Problem 2
- The requested PHP extension ext-mbstring * is missing from your system. Install or enable PHP's mbstring extension.
Problem 3
- Installation request for pelago/emogrifier 0.1.1 -> satisfiable by pelago/emogrifier[v0.1.1].
- pelago/emogrifier v0.1.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
...
Then, I searched for the available intl & intl extensions, using below commands.
yum list php*intl
yum install php-intl.x86_64
yum list php*mbstring
yum install php-mbstring.x86_64
And it fixed the issue.
In latest XAMPP version;
You need to find only intl(Line no 912)in php.ini file.
Change
;extension=intl
To
extension=intl
I have faced the same issue on my server. And it is mainly happened due to miss-match of php version between server version and your system version. I am using Nginx and checked on all my project configuration files, it uses php8.0 but on my terminal it shows php.8.1. Actually my application needs php8.0. The following steps resolved my issue.
To see all my running php versions
sudo update-alternatives --config php
It shows the following page
Selecting php8.0 for my application. Run the command to see Nginx scripts are ok
sudo nginx -t
Then reload the Nginx
sudo systemctl reload nginx
Finally go to your project directory and update or install your composer
composer update
It has been resolved my issue, I expect same will resolve yours.
In my case, I am using ubuntu, run this command, it will be solved if your system is also ubuntu.
sudo apt-get install php-intl