Code Monkey home page Code Monkey logo

Comments (7)

jpmurray avatar jpmurray commented on May 10, 2024 1

GOT IT !

Running phpversion() on specific version rather than default CLI indeed has shown me the error (with imagemagik). Went on and disabled it and, lo and behold, nothing's broken anymore ! TIL: where exactly are the executable that enables me to do that !

Thanks for your help !

from phpmon.

jpmurray avatar jpmurray commented on May 10, 2024 1

You got me to the right directions !

I had a export PATH="$(brew --prefix php)/bin:$PATH" to make sure PHP was loaded. I don't know why I did this, but it's definitely not really useful. Commenting it out has the right CLI version loading up. And boy does it make my shell snappy when loading it ! Good riddance to that line ! :)

Thank you again !

from phpmon.

nicoverbruggen avatar nicoverbruggen commented on May 10, 2024

When PHP Monitor warns you about a broken PHP version, it usually means that php -v contains some sort of warning.

So let's find out! While PHP Monitor displays "BROKEN", what does php -v output in your terminal? That should help you understand more what's going on.

Feel free to post the output below.

from phpmon.

jpmurray avatar jpmurray commented on May 10, 2024

All right, so having PHP Montitor set to:

  • PHP 8.0, output is normal, gives me version 8.0.3. PHP info, from the PHP Monitor menu says 8.0.3 with not errors either.
  • PHP 7.1, output is normal, gives me version... 8.0.3. PHP info, from the PHP Monitor menu says 7.1.33 with not errors either.
  • PHP 7.4, output is normal, gives me version... 8.0.3, PHP info, from the PHP Monitor menu says 7.4.6 with not errors either and with this one, the status bar icon is "broken".

Even if it says broken, I can load perfectly load my local PHP applications on the "broken" 7.4.

Seems it doesn't switch the PHP CLI, but only PHP-FPM, I don't know if it's normal behavior :)

from phpmon.

nicoverbruggen avatar nicoverbruggen commented on May 10, 2024

Why you're getting "broken"

The thing is, PHP Monitor indicates an installation is "broken" if the PHP version you selected contains the string "warning" or "error" in the output of php -r "print phpversion();".

(But note, I specifically run that on the PHP binary, not the PHP version that is linked. So since your CLI is always on 8.0, it makes sense you're not seeing the warnings.)

Diagnostics

Try running:

/usr/local/opt/[email protected]/bin/php -r "print phpversion();"

OR

/usr/local/opt/[email protected]/bin/php -v

You should see an error or a warning here in the output. Usually this is a duplicate extension declaration causing issues, or an extension that couldn't be loaded. You'll have to solve that issue yourself (usually by removing the offending extension or reinstalling).

(If you are on Apple Silicon, this becomes: /opt/homebrew/opt/[email protected]/bin/php -r "print phpversion();" due to the updated location of Homebrew.)

Possible solution

Can you try the "Force load latest PHP version" (which usually fixes misconfigurations) and then switch to PHP 7.4?
After you've done this, what do you get on the CLI then when you run php -v?

from phpmon.

jpmurray avatar jpmurray commented on May 10, 2024

Hey, figured I'd ask you... I never really worked with multiple version on my dev machine, and PHP Monitor got me excited for finally an easy solution for that... So I wonder, is there a way that we could also make the switch for PHP-CLI when switching within PHP Montior ?

from phpmon.

nicoverbruggen avatar nicoverbruggen commented on May 10, 2024

Since PHP Monitor changes the linked version via Homebrew, it should already do this! After switching, both Valet and your terminal (CLI) should use the new PHP version.

If you've got your shell environment set up correctly, and your PATH points to Homebrew's bin folder, you should automatically have the PHP version that is linked accessible in your terminal.

That might look like this:

export PATH=$HOME/bin:/usr/local/bin:$PATH

You might have a specific version of PHP linked if that is not the case. In that case, you may need to change your .bashrc/.bash_profile/.zshrc file where the PATH is set (depending on the terminal you use).

You can find out which version of PHP is being used by running which php.

which php should return either /usr/local/bin/php or /opt/homebrew/bin/php. (If you go there with Finder, you'll find that this is simply an alias to the /opt folder we discussed earlier in this thread.)

from phpmon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.