Open piperone opened 4 years ago
Hi, I'm glad you like xDebugToggler.
This is a kind of a known issue. Sometimes even running valet restart
is not enough, PhpStorm also needs to be restarted.
For the next version; running commands with sudo
and/or custom commands
will be the first priority.
Thanks for noticing.
A restart valet option would be nice.
Hello,
I've just discovered this wonderful little tool and this exact issue is cropping up!
Valet requires that the php services is run by root and not the user, so when this tool tries to restart the brew service it doesn't use sudo
or valet restart
Really hoping at some stage this might be incorporated!
Thank you very much @deligoez
https://developer.apple.com/forums/thread/91350 https://developer.apple.com/forums/thread/99151
Of course, having looked into this a little, it appears nothing will be easy! 🙄
Hi Everybody,
Thanks for your suggestions.
Before diving into running sudo
commands from swift. I think I found a quick way to restart valet
.
valet
has a trust
command which makes valet
commands run without root
user password.
I'll start to implement this today.
Is this project maintained anymore? Really would like it to include valet restart. In the meantime you can just add this to your ~/.bashrc or ~/.zshrc file. Then you'll be able to turn on/off xdebug from the terminal
# Enabled/Disable valet php xdebug extension.
function valet:xdebug() {
STATE="${1:?Missing argument, pass either on|off.}"
PHP_EXT_XDEBUG="/usr/local/etc/php/7.4/conf.d/ext-xdebug.ini"
if [[ $STATE == "on" && -f "$PHP_EXT_XDEBUG.disabled" ]]; then
mv "$PHP_EXT_XDEBUG.disabled" $PHP_EXT_XDEBUG
fi
if [[ $STATE == "off" && -f $PHP_EXT_XDEBUG ]]; then
mv $PHP_EXT_XDEBUG "$PHP_EXT_XDEBUG.disabled"
fi
valet restart php
}
Then re-source using source ~/.zshrc
, now when you type valet:xdebug on|off
it should enable|disable xdebug and then do a valet restart php
.
Thanks for this really nifty little tool! I found it through the Laravel newsletter.
I have a bit of an issue. I use Laravel Valet for local development. I have Xdebug installed (the ext-xdebug.ini-file inside conf.d, etc) and it works fine. However, if I disable xdebug using the toggler and then re-enable it, xdebug appears not to be enabled. Even checking "--all" for which services to restart, xdebug is not active again until I run
valet restart
. I don't know why this is the case.One possible solution to this, would be adding an option for a "custom command" to run after toggling (instead of the brew services commands). Just a thought.
Thanks again.