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 create-project not working on Windows #1288

Open
AIC-BV opened this issue Jan 17, 2025 · 23 comments
Open

Composer create-project not working on Windows #1288

AIC-BV opened this issue Jan 17, 2025 · 23 comments
Milestone

Comments

@AIC-BV
Copy link
Contributor

AIC-BV commented Jan 17, 2025

Winter CMS Build

dev-develop

PHP Version

8.1

Database engine

MySQL/MariaDB

Plugins installed

No response

Issue description

I am trying to set up a new sideproject using the following command from the WinterCMS website:
composer create-project wintercms/winter my-project

This works untill the command runs php artisan winter:install
There is no option to select a database type and errors will be spammed untill it crashes.

Operation System: Windows
PHP version: PHP 8.2.11 (cli) (built: Sep 26 2023 15:25:14) (NTS Visual C++ 2019 x64)

Image

Image

Steps to replicate

composer create-project wintercms/winter my-project

Workaround

No response

@LukeTowers
Copy link
Member

Do you have SQLite support on your environment?

@LukeTowers
Copy link
Member

What OS are you using?

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 17, 2025

What OS are you using?

Windows

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 17, 2025

Do you have SQLite support on your environment?

I don't think so
(But I have no idea. Don't find anything about "Hosting provider + SQLite" when I quickly google it)

@LukeTowers
Copy link
Member

You're paying for a remote server that's running Windows? Windows is really only supported for local development, running it as a production server for a PHP application is a bit wild...

@damsfx
Copy link
Contributor

damsfx commented Jan 18, 2025

@AIC-BV I had the same problem with Windows Os.
WinterCMS is installed without any user interaction.
The result is an installation with default values and no idea of the password given to the site administrator.

I'm always forced to run a second installation with the --force option (php artisan winter:install --force).

It seems that composer on Windows can't run interactive commands.
See: #1242 (comment)

So what have been put in place to simplify WinterCMS installation for Linux and Mac Os users, complicates it for the minority of Windows users.

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 20, 2025

You're paying for a remote server that's running Windows? Windows is really only supported for local development, running it as a production server for a PHP application is a bit wild...

Oh no the remote server is Linux
But my device is Windows and I can't set it up using composer create-project wintercms/winter my-project

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 20, 2025

It seems that composer on Windows can't run interactive commands. See: #1242 (comment)

You are right, manually doing the php artisan winter:install does work.
I don't need the --force flag because the automatic install doesn't do anything anyways it just crashes instantly

@LukeTowers LukeTowers added this to the 1.2.8 milestone Jan 21, 2025
@LukeTowers LukeTowers changed the title composer create is not working Composer create-project not working on Windows Jan 21, 2025
@LukeTowers
Copy link
Member

@damsfx does the create-project command still not work for you even after the work done in those related PRs?

Also for @AIC-BV & @damsfx, what are you using to run PHP on Windows? Do you have WSL or are you just manually installing it or are you using something else entirely?

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 22, 2025

If I recall it correctly, you just install some things
https://www.php.net/downloads.php
https://getcomposer.org/

and then in cmdline/powershell I run php artisan serve in the root of the Winter project

I used to run XAMPP but its seems to be no longer needed (I connect to a hosted DB instead of a local one)

@damsfx
Copy link
Contributor

damsfx commented Jan 22, 2025

@LukeTowers

For my Windows computers, I have both WSL and standalone PHP.
No errors occurs when running create project from WSL.

Using composer create-project wintercms/winter:dev-develop test-composer-install :

  • winter:install : ✅, no user interactions
  • winter:env : ✅
  • winter:mirror public --relative : ❌
> @php artisan winter:mirror public --relative
Destination: P:\_Sites\_Labs\test-composer-install\public
 - Mirroring: .htaccess

In WinterMirror.php line 208:

  symlink(): Permission denied


Script @php artisan winter:mirror public --relative handling the post-create-project-cmd event returned with error code 1

@LukeTowers
Copy link
Member

@damsfx do you have this commit locally? 4a31245

LukeTowers added a commit that referenced this issue Jan 22, 2025
@LukeTowers
Copy link
Member

@damsfx give 85362e7 a try!

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 24, 2025

composer create-project wintercms/winter:dev-develop test-composer-install
Still crashes on ERROR could not find driver. for me

Image

@damsfx
Copy link
Contributor

damsfx commented Jan 24, 2025

@LukeTowers ...

Installing wintercms/winter (dev-develop 85362e7)
  • composer steps : ✅
  • winter:install : ✅ (no user interactions on Windows)
  • winter:env : ✅
  • winter:mirror public --relative : ✅

Work's both on Windows and in WSL.
Thank's for the fix !

What would be nice, is having the credits for logging into the site administration in the installation summary.
Ex:

   INFO  WinterCMS installation completed.

 - Application key [Mxi0QxErbH3ojNS6oaCQWa7QAqdiDS3x] set successfully.
 - Backend access: [http://localhost/backend]
 - Backend credentials: [admin/vTiX0p4NuCYjd8d9yr0tu6]

@AIC-BV on Windows OS, I can't choose which type of database to use too.
It seems that is the default behavior with Windows OS, because Composer scripts are not allowed to launch interactive commands.
So by default you get an installation running on SQLite database that is the default one on Laravel too from now.

For your issue, do you have extension=pdo_sqlite in your php.ini file ??
You also need to have php_pdo_sqlite.dll and php_sqlite3.dll in your PHP ext directory.

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 24, 2025

@damsfx Thanks for the clear answer.
I uncommented extension=pdo_sqlite and everything works again using composer create-project wintercms/winter:dev-develop test-composer-install! 🥳
I will have to read up on SQLite; I don't need an external DB anymore? It seems to save a file in the storage folder

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 24, 2025

But as @damsfx said the admin password/backend url/... are not shown so it would be a very handy summary indeed

@damsfx
Copy link
Contributor

damsfx commented Jan 24, 2025

@damsfx ... I will have to read up on SQLite; I don't need an external DB anymore? It seems to save a file in the storage folder

SQLite databases are contained within a single file on your filesystem, for WinterCMS at /storage/database.sqlite.
IMO it's a good way to get "basic" sites running for local development and/or doesn't have high number of queries per displayed page.
By the way, even for this kind of sites in production, I prefer using a MariaDB database.

If the project have a lot of queries per page (access to models like in online shop), I always choose a MariaDB database.

Please note that this point of view is neither scientific nor supported by extensive performance tests, it's just a matter of habit.

@AIC-BV
Copy link
Contributor Author

AIC-BV commented Jan 24, 2025

I see!
Thanks for clarifying that 😊

@LukeTowers
Copy link
Member

LukeTowers commented Jan 25, 2025

SQLite works perfectly fine for a read-heavy site, it only really becomes a potential issue if you have multiple processes trying to write to it at the same time or if you have truly insane traffic or want to scale across multiple servers. Take a look at https://stackoverflow.com/a/265607 for more information.

Long and short of it, most people will be just fine using SQLite which is why it's the default. Even if you're not using it as your main database driver however it's still highly recommended to have the extension installed and active because certain features of Winter make use of SQLite (the ArraySource database trait as one example).

@damsfx as far as showing the information for accessing the backend in the installation summary; that might be a limitation in how those commands are run on Windows through Composer. If you run artisan winter:down and then artisan migrate on your fresh install does it give you the admin credentials then?

@jaxwilko is this something that might be fixed with the refactor to the UpdateManager?

@LukeTowers
Copy link
Member

Side note @damsfx & @AIC-BV, do you know about the winter:passwd command?

@damsfx
Copy link
Contributor

damsfx commented Jan 25, 2025

Side note @damsfx & @AIC-BV, do you know about the winter:passwd command?

Yes, of course!

@damsfx
Copy link
Contributor

damsfx commented Jan 25, 2025

@damsfx as far as showing the information for accessing the backend in the installation summary; that might be a limitation in how those commands are run on Windows through Composer. If you run artisan winter:down and then artisan migrate on your fresh install does it give you the admin credentials then?

@LukeTowers

php artisan winter:down --force && php artisan migrate
...

   INFO  Migration complete.

   INFO  \Backend\Database\Seeds\DatabaseSeeder reported the following:

    - The following password has been automatically generated for the "admin" account: ywh3enVGoVHbIOjyEyjlR7

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