Valet doesn't work for previous php version after upgrading php. Failed to open stream: Operation not permitted #1363
-
My existing version was php8.1 using Laravel Valet 3.3.2. I did a brew php install and the php version was updated to php8.2 The site loaded fine on php8.2. When I switched to use the older version using
I get this error
However, these scenarios below worked fine
For this last one, the site could work if I used artisan serve instead of valet and loaded the page via 127.0.0.1:8000 I have tried most of the solutions I could find online. The most comprehensive being to uninstall and reinstall everything related to valet.
And then reinstall php, composer and valet. I tried this a few times using different combinations and ensuring the config files are removed when prompted by brew. I've also tried setting the public folder and index.php file to 777. The problem still persisted. On console, when doing
I get
So it seems that this error occurs under the scenario when valet uses php8.1, which was my previous default php version. Probably some config or links related to valet that was not updated / removed. I would appreciate if anyone can point me in any direction to investigate further. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I'm facing the same issue |
Beta Was this translation helpful? Give feedback.
-
When switching PHP versions, particularly when downgrading, it is wise to rebuild the global composer vendor dependencies. composer global update Also useful whenever you want to switch your command-line version temporarily is to insert the specific PHP version at the beginning of your environment PATH, so that all export PATH="$(brew --prefix [email protected])/bin:$PATH" (replacing |
Beta Was this translation helpful? Give feedback.
When switching PHP versions, particularly when downgrading, it is wise to rebuild the global composer vendor dependencies.
Also useful whenever you want to switch your command-line version temporarily is to insert the specific PHP version at the beginning of your environment PATH, so that all
php
calls use that version, overriding whatever the main default is set to:(replacing
8.2
with whatever your current terminal session needs, for whatever project you're working on)