Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer does not work on windows #109

Closed
nedaeidev opened this issue Sep 2, 2024 · 4 comments
Closed

Composer does not work on windows #109

nedaeidev opened this issue Sep 2, 2024 · 4 comments

Comments

@nedaeidev
Copy link

nedaeidev commented Sep 2, 2024

After installing Composer, a folder will be created in which only the main file of Composer is located.
This file cannot be used alone for Windows and there must be a bat file with the same name in the folder, so that after adding the folder path to the system path, Windows can run the Composer.
Now we have access to composer out of the box as a command line.

tested with PhpWebStudy v4.2

Please add the bat file (composer.bat) with the following content in the Composer-x.x.x folder:

@echo off
php "%~dp0composer.phar" %*

@nedaeidev nedaeidev changed the title Composer does not work properly on windows Composer does not work on windows Sep 2, 2024
@vesper8
Copy link

vesper8 commented Sep 2, 2024

I've manually added php to the system environment variables because the "add to path" menu action doesn't seem to work on Windows.

I was then able to run composer like this:

php C:\Users\xxx\AppData\Local\Programs\PhpWebStudy-Data\app\composer-2.7.8\composer.phar install

But then I ran into issues because some php extensions are missing

@nedaeidev
Copy link
Author

nedaeidev commented Sep 2, 2024

I've manually added php to the system environment variables because the "add to path" menu action doesn't seem to work on Windows.

I was then able to run composer like this:

php C:\Users\xxx\AppData\Local\Programs\PhpWebStudy-Data\app\composer-2.7.8\composer.phar install

But then I ran into issues because some php extensions are missing

"add to path" menu action work for me

if you want to run composer you must create a file in below URI and it's name should be composer.bat
C:\Users\xxx\AppData\Local\Programs\PhpWebStudy-Data\app\composer-2.7.8\composer.bat
then add below code in to composer.bat

#begin code:

@echo off
php "%~dp0composer.phar" %*

#end code

now composer command work on cmd and power shell

@xpf0000
Copy link
Owner

xpf0000 commented Sep 3, 2024

Thank you for your reminder. The lasted version has fixed this issues. composer.bat will auto create when composer install or add to path.

@nedaeidev
Copy link
Author

Thank you for fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants