spatie/global-ray

Anyone managed to get this working on linux based systems?

Closed this issue · 5 comments

Love the idea of not needing to install the package on a per-project basis. Trying to install on ubuntu 18 - php 8.0:

The package installs no problem but the global-ray is have permissions issues.

$ global-ray install
Updating PHP ini: /etc/php/8.0/cli/php.ini
PHP Warning:  file_put_contents(/etc/php/8.0/cli/php.ini): Failed to open stream: Permission denied in /home/forge/.composer/vendor/spatie/global-ray/src/Support/PhpIni.php on line 36

Warning: file_put_contents(/etc/php/8.0/cli/php.ini): Failed to open stream: Permission denied in /home/forge/.composer/vendor/spatie/global-ray/src/Support/PhpIni.php on line 36
Unable to update PHP ini.

Trying with sudo doesn't help.

$ sudo global-ray install
sudo: global-ray: command not found

This package has not been released yet. Please try a little bit later.

Thanks Freek!

xewl commented

Had the same problem now too inside WSL. My user has no write access to php.ini files.
Might be useful to skip the step on failure and tell us what to change instead of failing =D
(or write it to ~/.user.ini instead -- filename should probably be checked via ini_get('user_ini.filename') or the PHP.ini lib - just a train of thought, didn't check, added it manually to my php.ini instead)

My user has no write access to php.ini files.

Is there some kind of sudo in WSL that you can use?

xewl commented

Is there some kind of sudo in WSL that you can use?

sure; sudo's def there.
It could indeed retry the PHP.ini replacement with sudo if it failed at first.

(We just can't start the install command from sudo, because that would try to reach composer in the root user, and as the composer isn't there, it won't know "global-ray" either)

Adding a question might be better UX in the long end
[0] Let us try | retry with sudo
[1] I'll add it manually

(and show the option, you can still read it out btw, so.. you could append if there's an existing value)
I run multiple PHP Versions too, so.. the manual option was best for me in any case :')
(+ it adds to /cli/ and I need it in fpm too ofc)