laravel / valet

A more enjoyable local development experience for Mac.
https://laravel.com/docs/valet
MIT License
2.52k stars 698 forks source link

Space in "Application Support" Causing Error During "valet share" Command #1472

Closed zaimazhar closed 6 months ago

zaimazhar commented 9 months ago

Description

Laravel Valet 4.6.1

# Project
"php": "^8.0.2",
"laravel/framework": "^9.19",

I have removed Herd since but the problem still persists...

image

Steps To Reproduce

Diagnosis

sw_vers
ProductName:       macOS
ProductVersion:     14.2.1
BuildVersion:       23C71
valet --version
Laravel Valet 4.6.1
cat ~/.config/valet/config.json
{
    "tld": "test",
    "loopback": "127.0.0.1",
    "paths": [
        "/Users/muhammadzaimazharahmad/projects"
    ],
    "share-tool": "ngrok"
}
cat ~/.composer/composer.json
{
    "require": {
        "laravel/installer": "^4.2",
        "beyondcode/expose": "^2.6",
        "laravel/vapor-cli": "^1.54",
        "friendsofphp/php-cs-fixer": "^3.8",
        "laravel/valet": "^4.6"
    }
}
composer global diagnose
Changed current directory to /Users/muhammadzaimazharahmad/.composer
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK git version 2.39.3
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking Composer version: OK
Checking Composer and its dependencies for vulnerabilities: OK
Composer version: 2.7.1
PHP version: 8.3.3
PHP binary path: /Users/muhammadzaimazharahmad/Library/Application Support/Herd/bin/php83
OpenSSL version: OpenSSL 3.1.4 24 Oct 2023
cURL version: 8.6.0 libz 1.3.1 ssl OpenSSL/3.1.4
zip: extension present, unzip present, 7-Zip not available
composer global outdated
Changed current directory to /Users/muhammadzaimazharahmad/.composer
Legend:
! patch or minor release available - update recommended
~ major release available - update possible

Direct dependencies required in composer.json:
laravel/installer        v4.5.1 ~ v5.5.2 Laravel application installer.

Transitive dependencies not required in composer.json:
brick/math               0.11.0 ~ 0.12.1 Arbitrary-precision arithmetic library
nesbot/carbon            2.72.3 ~ 3.0.2  An API extension for DateTime that ...
symfony/console          v6.4.4 ~ v7.0.4 Eases the creation of beautiful and...
symfony/event-dispatcher v6.4.3 ~ v7.0.3 Provides tools that allow your appl...
symfony/finder           v6.4.0 ~ v7.0.0 Finds files and directories via an ...
symfony/process          v6.4.4 ~ v7.0.4 Executes commands in sub-processes
symfony/translation      v6.4.4 ~ v7.0.4 Provides tools to internationalize ...
ls -al /etc/sudoers.d/
total 0
drwxr-xr-x   2 root  wheel    64 Feb 27 19:19 .
drwxr-xr-x  80 root  wheel  2560 Feb 27 15:29 ..
brew config
HOMEBREW_VERSION: 4.2.10
ORIGIN: https://github.com/Homebrew/brew
HEAD: c6d959218f143cd17b1fc3e0f10f143cbd273528
Last commit: 2 days ago
Core tap JSON: 27 Feb 11:58 UTC
Core cask tap JSON: 27 Feb 11:58 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.2.1-arm64
CLT: 15.1.0.0.1.1700200546
Xcode: N/A
Rosetta 2: false
brew services list
Warning: running through sudo, using user/* instead of gui/* domain!
Hide this warning by setting HOMEBREW_SERVICES_NO_DOMAIN_WARNING.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Name    Status User File
dnsmasq none            root 
nginx   none            root 
php     none            root
brew list --formula --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
dnsmasq 2.90
nginx 1.25.4
openssl@1.1 1.1.1w
php 8.3.3_1
brew outdated

brew tap
homebrew/cask
homebrew/core
homebrew/services
ngrok/ngrok
shivammathur/php
php -v
PHP 8.3.3 (cli) (built: Feb 16 2024 00:15:01) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.3, Copyright (c), by Zend Technologies
which -a php
/Users/muhammadzaimazharahmad/Library/Application Support/Herd/bin//php
/opt/homebrew/bin/php
php --ini
Configuration File (php.ini) Path: /lib
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
nginx -v
nginx version: nginx/1.25.4
curl --version
curl 8.4.0 (x86_64-apple-darwin23.0) libcurl/8.4.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.55.1
Release-Date: 2023-10-11
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets
php --ri curl
curl

cURL support => enabled
cURL Information => 8.6.0
Age => 10
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => No
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => No
SPNEGO => No
SSL => Yes
SSPI => No
TLS-SRP => Yes
HTTP2 => Yes
GSSAPI => No
KERBEROS5 => No
UNIX_SOCKETS => Yes
PSL => No
HTTPS_PROXY => Yes
MULTI_SSL => No
BROTLI => No
ALTSVC => Yes
HTTP3 => No
UNICODE => No
ZSTD => No
HSTS => Yes
GSASL => No
Protocols => dict, file, ftp, ftps, gopher, gophers, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtsp, smb, smbs, smtp, smtps, telnet, tftp
Host => Darwin
SSL Version => OpenSSL/3.1.4
ZLib Version => 1.3.1

Directive => Local Value => Master Value
curl.cainfo => no value => no value
/opt/homebrew/bin/ngrok version
ngrok version 3.6.0
ls -al ~/.ngrok2
total 8
drwx------   3 muhammadzaimazharahmad  staff    96 Jun 20  2022 .
drwxr-x---+ 69 muhammadzaimazharahmad  staff  2208 Feb 27 19:58 ..
-rw-------   1 muhammadzaimazharahmad  staff    61 Jun 20  2022 ngrok.yml
brew info nginx
==> nginx: stable 1.25.4 (bottled), HEAD
HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
https://nginx.org/
/opt/homebrew/Cellar/nginx/1.25.4 (26 files, 2.4MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-02-27 at 19:28:43
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/n/nginx.rb
License: BSD-2-Clause
==> Dependencies
Required: openssl@3, pcre2
==> Options
--HEAD
    Install HEAD version
==> Caveats
Docroot is: /opt/homebrew/var/www

The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /opt/homebrew/etc/nginx/servers/.

To start nginx now and restart at login:
  brew services start nginx
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/nginx/bin/nginx -g daemon\ off\;
==> Analytics
install: 13,121 (30 days), 33,176 (90 days), 170,868 (365 days)
install-on-request: 13,076 (30 days), 33,064 (90 days), 170,506 (365 days)
build-error: 13 (30 days)
brew info php
==> php: stable 8.3.3 (bottled), HEAD
General-purpose scripting language
https://www.php.net/
/opt/homebrew/Cellar/php/8.3.3_1 (523 files, 93.1MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-02-27 at 19:27:31
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/p/php.rb
License: PHP-3.01
==> Dependencies
Build: httpd, pkg-config
Required: apr, apr-util, argon2, aspell, autoconf, curl, freetds, gd, gettext, gmp, icu4c, krb5, libpq, libsodium, libzip, oniguruma, openldap, openssl@3, pcre2, sqlite, tidy-html5, unixodbc, imap-uw
==> Options
--HEAD
    Install HEAD version
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so

    
        SetHandler application/x-httpd-php
    

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /opt/homebrew/etc/php/8.3/

To start php now and restart at login:
  brew services start php
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/php/sbin/php-fpm --nodaemonize
==> Analytics
install: 59,997 (30 days), 173,014 (90 days), 639,452 (365 days)
install-on-request: 56,183 (30 days), 161,763 (90 days), 595,864 (365 days)
build-error: 68 (30 days)
brew info openssl
==> openssl@3: stable 3.2.1 (bottled)
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/opt/homebrew/Cellar/openssl@3/3.2.1 (6,874 files, 32MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-02-27 at 14:13:06
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/o/openssl@3.rb
License: Apache-2.0
==> Dependencies
Required: ca-certificates
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /opt/homebrew/etc/openssl@3/certs

and run
  /opt/homebrew/opt/openssl@3/bin/c_rehash
==> Analytics
install: 418,939 (30 days), 1,206,457 (90 days), 3,876,495 (365 days)
install-on-request: 62,384 (30 days), 166,006 (90 days), 613,588 (365 days)
build-error: 4,507 (30 days)
openssl version -a
OpenSSL 3.2.1 30 Jan 2024 (Library: OpenSSL 3.2.1 30 Jan 2024)
built on: Tue Jan 30 13:14:56 2024 UTC
platform: darwin64-arm64-cc
options:  bn(64,64)
compiler: clang -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -D_REENTRANT -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
OPENSSLDIR: "/opt/homebrew/etc/openssl@3"
ENGINESDIR: "/opt/homebrew/Cellar/openssl@3/3.2.1/lib/engines-3"
MODULESDIR: "/opt/homebrew/Cellar/openssl@3/3.2.1/lib/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_armcap=0x987d
openssl ciphers
TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:RSA-PSK-AES256-GCM-SHA384:DHE-PSK-AES256-GCM-SHA384:RSA-PSK-CHACHA20-POLY1305:DHE-PSK-CHACHA20-POLY1305:ECDHE-PSK-CHACHA20-POLY1305:AES256-GCM-SHA384:PSK-AES256-GCM-SHA384:PSK-CHACHA20-POLY1305:RSA-PSK-AES128-GCM-SHA256:DHE-PSK-AES128-GCM-SHA256:AES128-GCM-SHA256:PSK-AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:ECDHE-PSK-AES256-CBC-SHA384:ECDHE-PSK-AES256-CBC-SHA:SRP-RSA-AES-256-CBC-SHA:SRP-AES-256-CBC-SHA:RSA-PSK-AES256-CBC-SHA384:DHE-PSK-AES256-CBC-SHA384:RSA-PSK-AES256-CBC-SHA:DHE-PSK-AES256-CBC-SHA:AES256-SHA:PSK-AES256-CBC-SHA384:PSK-AES256-CBC-SHA:ECDHE-PSK-AES128-CBC-SHA256:ECDHE-PSK-AES128-CBC-SHA:SRP-RSA-AES-128-CBC-SHA:SRP-AES-128-CBC-SHA:RSA-PSK-AES128-CBC-SHA256:DHE-PSK-AES128-CBC-SHA256:RSA-PSK-AES128-CBC-SHA:DHE-PSK-AES128-CBC-SHA:AES128-SHA:PSK-AES128-CBC-SHA256:PSK-AES128-CBC-SHA
sudo nginx -t
nginx: the configuration file /opt/homebrew/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /opt/homebrew/etc/nginx/nginx.conf test is successful
which -a php-fpm
/opt/homebrew/sbin/php-fpm
/opt/homebrew/opt/php/sbin/php-fpm -v
PHP 8.3.3 (fpm-fcgi) (built: Feb 13 2024 15:41:14)
Copyright (c) The PHP Group
Zend Engine v4.3.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.3, Copyright (c), by Zend Technologies
sudo /opt/homebrew/opt/php/sbin/php-fpm -y /etc/php-fpm.conf --test
[27-Feb-2024 19:58:52] ERROR: failed to open configuration file '/etc/php-fpm.conf': No such file or directory (2)
[27-Feb-2024 19:58:52] ERROR: failed to load configuration file '/etc/php-fpm.conf'
[27-Feb-2024 19:58:52] ERROR: FPM initialization failed
ls -al ~/Library/LaunchAgents | grep homebrew
-rw-r--r--   1 muhammadzaimazharahmad  staff   685 Apr  4  2022 homebrew.mxcl.redis.plist
ls -al /Library/LaunchAgents | grep homebrew

ls -al /Library/LaunchDaemons | grep homebrew
-rw-r--r--   1 root  admin   797 Feb 27 19:29 homebrew.mxcl.dnsmasq.plist
-rw-r--r--   1 root  admin   685 Feb 27 19:29 homebrew.mxcl.nginx.plist
-rw-r--r--   1 root  admin   781 Feb 27 19:28 homebrew.mxcl.php.plist
-rw-r--r--   1 root  admin   594 Jul 14  2023 homebrew.mxcl.php@7.4.plist
-rw-r--r--   1 root  admin   789 Feb 27 17:40 homebrew.mxcl.php@8.1.plist
-rw-r--r--   1 root  admin   789 Feb 27 15:34 homebrew.mxcl.php@8.2.plist
ls -al /Library/LaunchDaemons | grep "com.laravel.valet."

ls -aln /etc/resolv.conf
lrwxr-xr-x  1 0  0  22 Dec 15 22:43 /etc/resolv.conf -> ../var/run/resolv.conf
cat /etc/resolv.conf
#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
#   scutil --dns
#
# SEE ALSO
#   dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
nameserver fe80::a62a:95ff:feb6:6d5c%en0
nameserver 192.168.0.1
ifconfig lo0
lo0: flags=8049 mtu 16384
    options=1203
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201
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"'
------
/opt/homebrew/etc/nginx/valet/valet.conf
---

3:    #listen VALET_LOOPBACK:80; # valet loopback

------
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'
------
~/.config/valet/dnsmasq.d/tld-test.conf
---

address=/.test/127.0.0.1
listen-address=127.0.0.1

------
sh -c 'for file in ~/.config/valet/nginx/*; do echo "------\n~/.config/valet/nginx/$(basename $file)\n---\n"; cat $file | grep -n "# valet loopback"; echo "\n------\n"; done'
------
~/.config/valet/nginx/ISNAP-V2.test
---

5:    #listen VALET_LOOPBACK:80; # valet loopback

------

------
~/.config/valet/nginx/matchbankv2.test
---

5:    #listen VALET_LOOPBACK:80; # valet loopback

------
drbyte commented 9 months ago

You can manually apply the fix: ~/.composer/vendor/laravel/valet/valet, line 48 Add quotes around $PHP:

-    SHARETOOL="$($PHP "$DIR/cli/valet.php" share-tool)"
+    SHARETOOL="$("$PHP" "$DIR/cli/valet.php" share-tool)"

Once it's fixed in a new Valet version, running composer global update laravel/valet will replace your temporary fix. (or it may prompt you whether to discard your changes, in which case choose Yes).