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

injecting PHP_FOLDER environment var in bat / sh files #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Lotti
Copy link
Contributor

@Lotti Lotti commented Dec 19, 2024

Hello devs!

I made this change to inject the php directory path as environment variable. In this way is possible to use $PHP_FOLDER in php.ini configuration file. With this variable, I can set paths in php.ini relative to php directory.

e.g.:

auto_prepend_file = ${PHP_FOLDER}\scripts\auto_prepend.php
auto_append_file = ${PHP_FOLDER}\scripts\auto_append.php
error_log = ${PHP_FOLDER}\logs\php_error.log

@Lotti
Copy link
Contributor Author

Lotti commented Dec 19, 2024

While I guarantee that it works for php.bat, I have doubts for php (sh) because I didn't understand why run that file under windows... the path reported in sh file doesn't match neither MINGW64 shell (e.g.: the bash shell coming with Git for Windows: /c/Users) or WSL subsystem (/mnt/c/Users).

I've switched from official PHPRC environment variable to a totally custom PHP_FOLDER environment variable because PHPRC can be used to specify an alternative path for php.ini

@hjbdev
Copy link
Owner

hjbdev commented Jan 2, 2025

I don't think I understand the use case for this, there is a php.ini file per version so those paths can be hardcoded can't they?

I might be misunderstanding

@Lotti
Copy link
Contributor Author

Lotti commented Jan 2, 2025

I don't think I understand the use case for this, there is a php.ini file per version so those paths can be hardcoded can't they?

I might be misunderstanding

Yes, you're right, is possible to achieve the same result by hardcoding the path in php.ini instead of hardcoding the environment variables that I'm proposing.

I mostly made this feature because it is easier to hardcode an environment variable and let pvm set the right path instead of rely on users.

Anyway feel free to drop it if it still feels useless to you.

I'll be back with another pull request that introduces composer soon :)

Thank you.

# Conflicts:
#	commands/help.go
#	commands/use.go
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

Successfully merging this pull request may close these issues.

2 participants