Getting error during use of composer installation on windows - php

I have executed the following command on windows command prompt
folder path >php composer.phar install
Getting Error
Could not open input file: composer.phar

Your command is trying to use composer which is not installed. It is not used to install composer. You have to install it using one of methods stated here:
https://getcomposer.org/doc/00-intro.md
The other option is that your path to composer file is wrong, which can also be fixed by following documentation.

Related

Switch php versions on start composer update

I have PHP v7.4 on Ubuntu server. And I have an alternative PHP in the path /opt/php81/bin/
I need to start command composer update with PHP 8.1
I tried like that /opt/php81/bin/php composer update but I see the error
Could not open input file: composer
I tried that /opt/php81/bin/php composer update --working-dir=/var/www/user/data/www/myweb.site
and I see the same error.
I found that this solution works !
/opt/php81/bin/php /usr/local/bin/composer update --working-dir=/var/www/user/data/www/myweb.site

How do I fix the following phpcs error in Visual Studio Code?

I am new to VS code. I am trying to work with PHP, but I keep getting this notification.
phpcs: Request workspace/configuration failed with message:unable to
locate phpcs. please add phpcs to your global path or use composer
dependency manager to install it in your project locally.
Intellisense doesn't work for PHP too.
I am using a Windows system. I tried to download and install Composer, but I am still getting the problem as shown in the screenshot.
]1
I have some extensions installed which are visible in the screenshot, but the issue persists.
The easiest way is to use composer to install phpcs globally and symlink the binary into your path;
Assuming you have composer installed and are using osx or linux (if not, follow instructions from here: composer) then install phpcs globally: open your terminal and type:
composer global require "squizlabs/php_codesniffer=*"
You will then need to make sure phpcs is in your path. The easiest way is to symlink into /usr/local/bin. open your terminal and type:
sudo ln -s ~/.composer/vendor/bin/phpcs /usr/local/bin/phpcs

ERROR: Your system is not ready to run Symfony projects

I've downloaded a Symfony application and then checked it using php -f ./app/check.php. However, I get:
[ERROR]
Your system is not ready to run Symfony projects
Fix the following mandatory requirements
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Vendor libraries must be installed
> Vendor libraries are missing. Install composer following
> instructions from http://getcomposer.org/. Then run "php
> composer.phar install" to install them.
However, there is no composer.phar file in this application. e.g.
php composer.phar install
Could not open input file: composer.phar
Note: I already have composer installed.
Any suggestions?
The answer is right there in the error message you received.
Install composer following instructions from http://getcomposer.org/
Instead of composer.phar run:
php composer install
I think that's what you need. If you install Composer, then you probably renamed it to composer, and that's the bin you run.

yii2 installation via composer - Could not open input file: composer.phar

I am trying to install the yii2 and after I installed the composer I tried to run composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
it says :
Could not open input file: composer.phar
Any suggestions ?
Make sure of composer work correctly.
php composer.phar -v
Try
php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
I know probably you've figured it out by now but still I want to help.
Make your composer.phar global so you can access it from anywhere. You can set path in environment variables or you can give direct path like below:
php C:\ProgramData\ComposerSetup\bin\composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
Note: I'm using Windows 8.1 and composer is installed in C directory.
First of all install composer in your system Like windows system. you can download composer from this url https://getcomposer.org/download/. after install composer you can go to C:\composer check files for composer.phar and composer.bat files then copy both files and goto C:\xampp\php paste both files here and restart xampp then after that you can install yii2

Could not open input file: composer.phar

I am trying to install zendframework using composer tool in wamp server.
The following steps are done towards installation
I downloaded the Composer-Setup.exe file from composer page and got successfully installed.
I downloaded the zendframework and extracted inside the c:\wamp\www\zend folder
I executed the command for self update
php composer.phar self-update
This line generates the error message: could not open file composer.phar
how to resolve this error
If I try the
composer.phar self-update
Use this :
php -r "readfile('https://getcomposer.org/installer');" | php
This will install composer to the current directory so that you can use php composer.phar
The composer.phar install is not working but without .phar this is working.
We need to enable the openssl module in php before installing the zendframe work.
We have to uncomment the line ;extension=php_openssl.dll from php.ini file.
composer use different php.ini file which is located at the wamp\bin\php\php-<version number>\php.ini
After enabling the openssl we need to restart the server.
The execute the following comments.
I can install successfully using these commands -
composer self-update
composer install --prefer-dist
I was trying to install YII 2.0
php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.0-alpha
I got the same error:
Could not open input file: composer.phar
Then i gave the full path of .phar like this:
php C:\ProgramData\Composer\bin\composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.0-alpha
and it worked.
I am using Windows 7, and I got the same problem as yours while using Composer via cmd.
The problem is solved when I use
php C:\ProgramData\ComposerSetup\bin\composer.phar create-project slim/slim-skeleton
instead of
php composer.phar create-project slim/slim-skeleton
Hope this is useful for people who got the same problem.
First try this: dont use the php composer.phar [parameters] simply use composer [parameters] if this doesn't work for you than try the rest. Hope it helps.
Question already answered by the OP, but I am posting this answer for anyone having similar problem, retting to
Could not input open file: composer.phar
error message.
Simply go to your project directory/folder and do a
composer update
Assuming this is where you have your web application:
/Library/WebServer/Documents/zendframework
change directory to it, and then run composer update.
Initially, I was running php composer.phar self-update and got the same error message.
As a resolve, you should use composer command directly after install it.From the command prompt, just type composer and press enter.
If composer is installed correctly then you should able to see a lot of suggestion and command list from composer.
If you are up to this point then you should able to run composer self-update directly.
Try in command line:
curl -sS https://getcomposer.org/installer | php
dont use php composer.phar self-update
First go to Your project directory
simply use composer.phar self-update
This works for me
I have fixed the same issue with below steps
Open project directory Using Terminal (which you are using i.e. mintty )
Now install composer within this directory as per given directions on https://getcomposer.org/download/
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'the-provided-hash-code') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Now run your command.
Everything is working fine now because the composer.phar file is available within the current project directory.
Copied from https://stackoverflow.com/questions/21670709/running-composer-returns-could-not-open-input-file-composer-phar/51907013#51907013
thanks
This is how it worked for me:
Make sure composer is installed without no errors.
Open "System Properties" on windows and go to the "Advanced" tab. (You can just press the windows button on your keyboard and type in "Edit the system environment variables`
"Environment variables"
Under "System variables" Edit "PATH"
Click on "New".
Type in: C:\ProgramData\ComposerSetup\bin\composer.phar
Close all folders & CMDs + restart you WAMP server.
Go to whatever directory you want to install a package in and type in
composer.phar create-project slim/slim-skeleton
for example.
If you go through the documentation, they have mentioned to use php composer.phar
Link: https://getcomposer.org/doc/03-cli.md#update-u
Don't use php composer.phar
only give composer
Command: composer self-update
It will work.
Instead of
php composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application path/to/install
use
php composer.phar create-project --repository-url="https://packages.zendframework.com" zendframework/skeleton-application path/to/install
Just add https instead of http in the URL. Though it's not a permanent solution, it does work.
Another solution could be.. find the location of composer.phar file in your computer. If composer is installed successfully then it can be found in the installed directory.
Copy that location & instead of composer.phar in the command line, put the entire path there.
It also worked for me!
I had the same issue when trying to use php composer install in a local directory on my Apache server for a laravel project I cloned from Github. My problem was I had already setup composer globally on my Ubuntu 18 machine. Adding sudo instead of php started the install of a whole slew of packages listed in the json.lock file i.e. sudo composer install.
Just Use composer install
composer install

Categories