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

Unable to pass command line arguments #591

Closed
wheakerd opened this issue Jan 26, 2025 · 7 comments
Closed

Unable to pass command line arguments #591

wheakerd opened this issue Jan 26, 2025 · 7 comments
Labels
question Further information is requested

Comments

@wheakerd
Copy link

./spc build --build-micro "filter,iconv,mbstring,phar,tokenizer,zlib" --enable-zts --with-upx-pack

bin/spc micro:combine composer.phar --with-micro=bin/micro.sfx -N php.ini -O composer

error:

./bin/composer install
Warning: Undefined array key "argv" in phar:///bin/composer/bin/composer on line 94

Warning: Trying to access array offset on null in phar:///bin/composer on line 94

Deprecated: realpath(): Passing null to parameter #1 ($path) of type string is deprecated in phar:///bin/composer/bin/composer on line 94

@crazywhalecc crazywhalecc added the bug Something isn't working label Jan 27, 2025
@crazywhalecc
Copy link
Owner

Composer should not be combined with micro sapi, it's not supported.

But if you want to achieve this, you need to build micro sapi with --with-micro-fake-cli option and re-combine the latest composer.phar with openssl, curl extension. Even after that, some composer functions are still unavailable.

@wheakerd
Copy link
Author

wheakerd commented Feb 5, 2025

@crazywhalecc I think this problem is not something I should consider for the time being. The problem I am facing now is that the command parameters used at runtime cannot be read in phar, and the parameter passing cannot be read through $_SERVER ['argv'].
For example, composer -V.
Error: Warning: Undefined array key "argv" in phar:///composer/bin/composer on line 93

@wheakerd
Copy link
Author

wheakerd commented Feb 5, 2025

@crazywhalecc However, hyperf and composer also use the same symfony dependency library, which hyperf can read. At this time, I am using micro.sfx from static-php-cli, but the one I built myself cannot.

@crazywhalecc
Copy link
Owner

What's your php.ini content embeded in your binary?

@wheakerd
Copy link
Author

wheakerd commented Feb 5, 2025

What's your php.ini content embeded in your binary?

emm... Thank you, I configured register_argc_argv = Off when I first debugged composer.
Hahaha, this is an interesting thing.

@crazywhalecc
Copy link
Owner

Nevermind. The real problem is indeed composer does not support micro SAPI, you need to make micro pretend to be cli SAPI and run it.

@crazywhalecc crazywhalecc added question Further information is requested and removed bug Something isn't working labels Feb 5, 2025
@wheakerd
Copy link
Author

wheakerd commented Feb 5, 2025

@crazywhalecc
This is awesome, there are no errors in the composer diagnostics!!!

You can provide the composer with a ca certificate in the project's composer.json.

{ "config": { "cafile": "/etc/ssl/certs/ca-certificates.crt" } }

Image

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

No branches or pull requests

2 participants