Closed chris-ware closed 1 year ago
I found the valet link --isolate --secure foobar
command does indeed link the correct domain (foobar.test), but the PHP version in .valetrc is ignored.
The --isolate switch does read the .valetrc file, but use it only for the isolation of the folders name, not the custom link "foobar" provided
I think we have two separate issues. @naabster would you mind spinning up a separate issue for that?
I made a tiny bit of progress but then had to leave earlier than expected. Here's what I did:
cd /tmp
mkdir linking-as-not-foobar
cd linking-as-not-foobar
echo "php=php@8.0" > .valetrc
valet link foobar --isolate
and here's my error:
So as we can see, we get this error when trying to isolate the directory:
at /Users/mattstauffer/.composer/vendor/laravel/valet/cli/Valet/Site.php:182
Valet\Site->getSiteUrl() at /Users/mattstauffer/.composer/vendor/laravel/valet/cli/Valet/PhpFpm.php:171
Valet\PhpFpm->isolateDirectory() at /Users/mattstauffer/.composer/vendor/laravel/valet/cli/includes/facades.php:22
It's passing in the directory instead of the isolated short name. Hopefully that's an easy fix when I have a bit more time!
I'm new to Valet and I stumbled upon this exact issue. I organize my projects something like this:
~/Projects/
└── <domain>
└── <subdomain> # 'www' for root
├── _codebase/ # vcs repository
│ └── public/ # document root
└── _resources/ # files, presentation, artifacts, etc.
This incidentally results in the same issue:
~/Projects/example.com/www/_codebase
$ valet link example --secure --isolate
A [example] symbolic link has been created in [~/.config/valet/Sites/example].
Restarting nginx...
The [example.test] site has been secured with a fresh TLS certificate.
Found '_codebase/.valetrc' or '_codebase/.valetphprc' specifying version: php@8.1
In Site.php line 182:
The [_codebase] site could not be found in Valet's site list.
link [--secure] [--isolate] [--] [<name>]
It took me a while to figure it out—given the many different ways Valet resolves sites—but the issue stems from the isolate
command defaulting to the current directory's name instead of the full path like the secure
command does.
A simple solution to this: provide the --site=
option to the isolate
sub-command with the given link name:
if (Site::phpRcVersion($name)) {
- $this->runCommand('isolate');
+ $this->runCommand('isolate --site="'.$name.'"');
} else {
Unfortunately, this does not work since mnapoli/silly v1.8.1 which introduced an untested change to how sub-commands are handled as a consequence of a easily confusing error message from symfony/console.
See mnapoli/silly#69 for further details, mnapoli/silly#70 for the fix of the dependency, and laravel/valet#1428 for the fix of this issue.
Will be in today's release. Thanks all
Description:
When running
valet link --isolate
with a custom name that doesn't match the directory name, such asvalet link foobar --isolate
, where the directory the site is in may be foobar.com, the isolate command doesn't seem to receive the custom name and ends up failing with the following validation error.Steps To Reproduce:
valet link --isolate foobar
Diagnosis
sw_vers
valet --version
cat ~/.config/valet/config.json
cat ~/.composer/composer.json
composer global diagnose
composer global outdated
ls -al /etc/sudoers.d/
brew config
brew services list
brew list --formula --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
brew outdated
brew tap
php -v
which -a php
php --ini
nginx -v
curl --version
php --ri curl
/opt/homebrew/bin/ngrok version
ls -al ~/.ngrok2
brew info nginx
brew info php
brew info openssl
openssl version -a
openssl ciphers
sudo nginx -t
which -a php-fpm
/opt/homebrew/opt/php/sbin/php-fpm -v
sudo /opt/homebrew/opt/php/sbin/php-fpm -y /opt/homebrew/etc/php/8.2/php-fpm.conf --test
ls -al ~/Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchDaemons | grep homebrew
ls -al /Library/LaunchDaemons | grep "com.laravel.valet."
ls -aln /etc/resolv.conf
cat /etc/resolv.conf
ifconfig lo0
sh -c 'echo "------\n/opt/homebrew/etc/nginx/valet/valet.conf\n---\n"; cat /opt/homebrew/etc/nginx/valet/valet.conf | grep -n "# valet loopback"; echo "\n------\n"'
sh -c 'for file in ~/.config/valet/dnsmasq.d/*; do echo "------\n~/.config/valet/dnsmasq.d/$(basename $file)\n---\n"; cat $file; echo "\n------\n"; done'