Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: herd command output ""No usable PHP version found" #1215

Closed
Nothing-Works opened this issue Dec 22, 2024 · 6 comments
Closed

[Bug]: herd command output ""No usable PHP version found" #1215

Nothing-Works opened this issue Dec 22, 2024 · 6 comments

Comments

@Nothing-Works
Copy link

Nothing-Works commented Dec 22, 2024

Platform

Windows

Operating system version

Win 10

System architecture

Windows

Herd Version

1.13.0

PHP Version

8.4.2

Bug description

image

I installed my php via herd as well. and I recently updated to PHP 8.4.2, not sure what's the problem here, I would assume it's some misconfiguration issue? but not sure how to/where to configure this

Steps to reproduce

No response

Relevant log output

got similar on my mac as well

image
@Nothing-Works
Copy link
Author

Nothing-Works commented Dec 22, 2024

after some more testing, so the problem only happens to me that if I only have PHP 8.4 installed, if I have both PHP 8.3 and 8.4 installed and even not using php8.3 herd --version still works, but if I only have php8.4 installed then herd command not working for some reason. is it a bug that herd cannot find the latest PHP 8.4.2?

so it seems like it's the find-usable-php.php not being updated again, is this file supposed to be updated by the user? I would assume herd should update that file if PHP 8.4 is installed but it does not seem to do that for me.

@bcorcoran
Copy link

Running into this as well. Hardcoded php8{0,1,2,3} into find-usable-php.php. Seems like a sloppy update. If php84 is the only one installed, everything breaks.

Using herd pro

@codedusting
Copy link

Ok, so here's the solution for this particular issue:

  1. In the <your_username>\.config\herd\bin\find-usable-php.php, add these if statements:
if (version_compare($linkedPhpVersion, $minimumPhpVersion) >= 0) {
    if (file_exists($binPath . '84' . DIRECTORY_SEPARATOR . 'php.exe')) {
        echo $binPath . '84' . DIRECTORY_SEPARATOR . 'php.exe';
    } elseif (file_exists($binPath . '83' . DIRECTORY_SEPARATOR . 'php.exe')) {
        echo $binPath . '83' . DIRECTORY_SEPARATOR . 'php.exe';
    } elseif (file_exists($binPath . '82' . DIRECTORY_SEPARATOR . 'php.exe')) {
        echo $binPath . '82' . DIRECTORY_SEPARATOR . 'php.exe';
    } elseif (file_exists($binPath . '81' . DIRECTORY_SEPARATOR . 'php.exe')) {
        echo $binPath . '81' . DIRECTORY_SEPARATOR . 'php.exe';
    }

    return;
}
  1. The original after the update on Windows had the 84 lines missing.

Now, the other issue appears which is this error:

Error:
 Translation namespaces

'Deprecated:\' is not recognized as an internal or external command,
operable program or batch file.

Deprecated:\ Valet\Site::getProxyHostForSite():\ Implicitly\ marking\ parameter\ $configContents\ as\ nullable\ is\ deprecated,\ the\ explicit\ nullable\ type\ must\ be\ used\ instead\ in\ phar://C:/Users/codedusting/.config/herd/bin/herd.phar/cli/Valet/Site.php\ on\ line\ 200
C:/Users/codedusting/.config/herd/bin/php84/php.exe c:\Users\codedusting\projects\php\chirper\vendor\_laravel_ide\discover-6537a2457ac47e5337d1511c0b337e1f.php

Issue is that I cannot find the Site.php. I am using Laravel Official VSCode Extension. Maybe that's the issue.

@bcorcoran
Copy link

@codedusting yeah, it's easy to figure out once you look at find-usable-php.php but this should be updated by the team working on Herd to not require hard-coded values. There must be a smarter way, such as reading and parsing dir/file names so that this doesn't need to be manually updated.

Starting to feel like Herd/Herd Pro is more work just keeping it working vs Homebrew (in my case on MacOS) and Valet.

@bcorcoran
Copy link

Also, the find-usable-php.php file is replaced on startup, making modifying this file manually not a valid fix.

@mpociot
Copy link
Member

mpociot commented Jan 9, 2025

This is now fixed in v1.14.0

@mpociot mpociot closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants