spatie / ray

Debug with Ray to fix problems faster
https://myray.app
MIT License
568 stars 102 forks source link

Unable to run global-ray install #648

Closed jonathan-dejong closed 2 years ago

jonathan-dejong commented 2 years ago

Describe the bug Trying to install global-ray on my CentOS remote dev env using this https://spatie.be/docs/ray/v1/installation-in-your-project/framework-agnostic-php#content-global-installation

I've got a sudo user but not using the root user (as one should not). When I've installed it through composer I can run: global-ray install which will then result in:

Warning: file_put_contents(/etc/php.ini): failed to open stream: Permission denied in /home/jonathan.dejong/.config/composer/vendor/spatie/global-ray/src/Support/PhpIni.php on line 36 ❌ Unable to update PHP ini.

If I try to run it with sudo I get this weird one: sudo: global-ray: command not found

I tried resolving it by actually installing global-ray through composer for the root user as well but no dice.

I did eventually solve it by running sudo with current PATH: sudo -E env "PATH=$PATH" global-ray install

However that only resolves the installation issue. Now you are instead faced with this when trying to run php (a website):

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required '/home/jonathan.dejong/.config/composer/vendor/spatie/global-ray/src/scripts/global-ray-loader.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0

Please help as I do not know why this install differs from all the others I've run for this dev env.

Versions Ray version (you can see this in "About Ray"): 1.19.0 PHP version: 7.4.26

To Reproduce Try to install global-ray on a non-root user in a remove env. (specifically CentOS)

Expected behavior Expecting the two install commands to work as they are documented.

Desktop (please complete the following information): CentOS Linux release 7.9.2009 (Core)

Additional context

freekmurze commented 2 years ago

I don't have access to a CentOS environment, so I can't test this out. I'd accept a PR that solves this for you.

That fatal error you're getting can be solved like this: https://github.com/spatie/global-ray#troubleshooting

jonathan-dejong commented 2 years ago

Hi @freekmurze thank you for a very quick response :)

Yes I've resolved it already by removing that line from my php.ini so all good there. Will see what I can work out with my friends here on why this happens.

Just to be clear on the process if I have a remote server. This is my interpretation of what is needed:

Locally

Remote

That should be enough yes?

freekmurze commented 2 years ago

That's correct!

freekmurze commented 2 years ago

Duplicate of #16