Comments (17)
Do you have suhosin installed? If so, does your config contain something like
suhosin.executor.include.whitelist = phar
Alternatively try running php -d error_reporting=E_ALL composer.phar to see if there are any hidden errors.
from composer.
I too am not able to install composer. Here is what Im doing/seeing:
$ php composer.phar install
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'The composer.json file could not be found in the current directory' in phar:///Users/xxx/composer.phar/bin/composer:37
Stack trace:
#0 /Users/xxx/composer.phar(15): require()
#1 {main}
thrown in phar:///Users/xxx/composer.phar/bin/composer on line 37
from composer.
That is entirely unrelated. While that message isn't output nicely, it does tell you what the problem is. You have not created a composer.json file. Please see http://packagist.org for instructions on how to use composer.
from composer.
I'm not running Suhosin. I got the same result with E_ALL and no error message was provided.
My configure looks like this:
from composer.
Just for kicks, I tried to install with the default OS X PHP and received the same error as @evan108108 above.
from composer.
That means it works correctly on OS X. Without a composer.json file Composer cannot know what to do. You must create one for your project before it can do anything.
from composer.
Try the things mentioned here: http://silex.sensiolabs.org/doc/usage.html#pitfalls
from composer.
@mikeyp I think your first issue was caused by the detect_unicode
PHP ini setting. You could try:
php -d detect_unicode=0 composer.phar install
@igorw linked a doc with details on how to permanently fix any CLI phar issues.
from composer.
@saltybeagle can we do anything to detect this early in the phar bootstrap and warn the user? This is a really nasty error.
from composer.
@Seldaek Maybe adding check to stub
?
Composer\Compiler::getStub()
<?php
if (ini_get('detect_unicode')) {
throw new \RuntimeException('Check your config, bro! ;-)');
}
from composer.
@Seldaek The error happens so early, I don't think it's something we can detect in userland code at runtime.
from composer.
@mikeyp: I unfortunately can't reproduce it here. Could you try the fix @stloyd suggested, and then run bin/compile to get a phar and try again with that? It'd be cool if we can advise users to do the right thing.
from composer.
@Seldaek It seems we can't (as @saltybeagle mentioned) do this in userland. As I see you changed a bit error when composer.json
is found, this should help to @mikeyp and @evan108108 (and other Mac'ers (tm)).
About issue with phar
... I was think about making command (in bin/
) that could run a check on php.ini
and return some common pitfall warnings. But as mention, user must run it alone, we cannot do it in phar (or in stub
as I suggested, this would fail on some OS [ubuntu works good, even when some pitfalls are detected as possible]).
It could look like:
bin/check_pitfalls
#!/usr/bin/env php
<?php
$errors = array();
if (false !== $unicode = ini_get('detect_unicode')) {
$errors['unicode'] = 'On';
}
if (false !== $readonly = ini_get('phar.readonly')) {
$errors['readonly'] = 'On';
}
if (false !== $hash = ini_get('phar.require_hash')) {
$errors['require_hash'] = 'On';
}
if (false !== $suhosin = ini_get('suhosin.executor.include.whitelist')) {
if (false === strpos($suhosin, ',') && $suhosin != 'phar') {
$errors['suhosin'] = $suhosin;
} else if (false === in_array('phar', explode(',', $suhosin))) {
$errors['suhosin'] = $suhosin;
}
}
if (false === empty($errors)) {
echo 'Composer detected that you have enabled some settings in your';
echo '`php.ini` file that can make Composer unable to work properly.';
echo "\n\n";
echo 'Make sure that you have changed options listed below:';
echo "\n";
foreach ($errors as $error => $actual) {
switch ($error) {
case 'unicode':
echo "\rdetect_unicode = Off (actual: {$actual})\n";
break;
case 'readonly':
echo "\rphar.readonly = Off (actual: {$actual})\n";
break;
case 'require_hash':
echo "\rphar.require_hash = Off (actual: {$actual})\n";
break;
case 'suhosin':
echo "\rsuhosin.executor.include.whitelist = phar (actual: {$actual})\n";
break;
}
}
exit(1);
}
from composer.
@stloyd That's an interesting proposal. I wonder if it would be worthwhile to cook up a simple install shell script (sort of like go-pear), which runs those simple checks, grabs the latest phar and sets up a bin/composer executable for the end-user.
from composer.
@saltybeagle I was thinking exacly about something like go-pear
(maybe not exacly in .bat
etc., just in php ;-) But this would lead to downloading, lets say, install_composer.php
;-) or something similar. Which would test userland for phar
, php.ini
, common pitfalls and maybe few others things :-)
@Seldaek, @naderman What do you think about such file ? I could make some work on php version if you would like this idea.
from composer.
@stloyd: Would be great I think, if you can just send it to the composer/getcomposer.org repo, it should probably be there.
from composer.
Closing in favor of #245
from composer.
Related Issues (20)
- Composer prefer lowest does not stop running HOT 7
- getcomposer.org/installer fails this morning (with output) HOT 17
- Composer Installer producing PHP error HOT 4
- Error when running composer-setup.php HOT 12
- Document Plugin API version bump HOT 3
- Composer 2.7.0 usage with root user leads to plugins not being loaded HOT 24
- Composer 2.7.0 breaks PHP Stan HOT 6
- Composer 2.7.x returns code 5 even if security audit passes HOT 1
- NeedsSudoCheck docker detection not working with Docker Buildx HOT 12
- unset autoload-dev.classmap via cli command
- Unable to Create "web" Directory for Drupal Projects in Docker with Composer 2.7.0 #11853 HOT 13
- Support for `safe.bareRepository explicit` Git config HOT 1
- ERROR: /packages.json: URL using bad/illegal format or missing URL when creating a new Docker/Laravel project HOT 3
- [ErrorException] Undefined array key "uid" when requiring package from artifactory HOT 2
- --ignore does not ignore package HOT 13
- Inconsistency in `Filesystem::ensureDirectoryExists` HOT 8
- Stand with Palestine against the occupation HOT 1
- Every time I execute dump-autoload οΌit has a zombie process HOT 2
- Socialite installation will have the default packages removed
- docs for config command should say more precisely that some features only work for the "extra" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from composer.