X-elFinder GUI-based Composer Update and User's home #271
Replies: 2 comments
-
After not working on this for a long time, I finally decided to definitely answer this question. Arcesilas, a french developer, pointed out some usefull environment variables defined on Windows: getenv('USERPROFILE'); USERPROFILE exists on any Windows, and it seems to be reliable, according to https://learn.microsoft.com/fr-fr/windows/desktop/shell/knownfolderid So, on Windows, to store data for the current user, check : APPDATA and LOCALAPPDATA Arcesilas released a package to make these tools reusable: https://github.com/Arcesilas/Platform |
Beta Was this translation helpful? Give feedback.
-
Pear Description The methods return a string of the directory (with trailing slash) if the directory can be determined, and NULL if it fails or isn't available on the system. For example, the "Shared Documents" folder exists on Windows only. If you run getSharedDocuments() on a Mac or Linux, the method will return NULL. The class does heavy use of environment variables. That means it is very likely that the methods fail when running in a php server module (e.g. apache) because there is user information available. Using them on command line (cli) scripts gives best results, as the class is meant to be used for such ones https://pear.php.net/manual/en/package.system.folders.intro.php |
Beta Was this translation helpful? Give feedback.
-
X-elFinder control panel provides a GUI-based control panel to run Composer and update vender for cloud storage.
Most local development tools - Apache/NGINX, MySQL/MariaDB, PHP - can determine the user's home, depending on the platform Linux, MacOS or Windows. However some other virtualisation tools, Docker containers, virtual machines, etc. fail to run composer.
Often due to users path e.g.
c:\Users\<username>\AppData\Roaming\<myapplication>\
or misconfiguration of openssl extension.
Composer uses an environment variable, getUserDirectory in composer/Platform package:
X-elFinder GUI-based update of composer and vendor with proper User's home path on Windows.
NOTE : Input examples to run PHP CLI command could be extended or provide instructions.
Beta Was this translation helpful? Give feedback.
All reactions