Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Wrong PHP version #39

Open
dorneanu opened this issue Dec 2, 2020 · 53 comments
Open

Wrong PHP version #39

dorneanu opened this issue Dec 2, 2020 · 53 comments

Comments

@dorneanu
Copy link

dorneanu commented Dec 2, 2020

Hi,

I've been trying to add this workflow to Alfred, however, I had the wrong PHP version installed:

[11:57:57.223] Logging Stopped.
[11:57:58.749] Logging Started...
[11:58:03.071] Time[Script Filter] Queuing argument ''
[11:58:03.232] Time[Script Filter] Script with argv '' finished
[11:58:03.234] ERROR: Time[Script Filter] Code 104: Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 7.3.0". You are running 7.1.33.
[11:58:03.235] ERROR: Time[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 7.3.0". You are running 7.1.33.

I've installed PHP 7.3 using brew:

$ brew install [email protected]

But that is afterwards located at /usr/local/opt/[email protected]/bin/php. How should I change/tell the script to use that binary?

Thanks in advance.

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

kinda surprised that composer is checking something actually, as the vendor packages should come preinstalled.

can you try php -v just to check that you've installed it through brew not enabled it?

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

oh and btw you might want to install [email protected] instead. [email protected] is entering security only so i'm gonna drop it soon :D

@dorneanu
Copy link
Author

dorneanu commented Dec 2, 2020

I've added that PATH to ~/.profile. But the PATH doesn't get changed.

MacBook:~ vdorneanu$ cat ~/.profile
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="$PATH:~/go/bin"
export PIPENV_VENV_IN_PROJECT=1
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="/usr/local/opt/[email protected]/sbin:$PATH"

MacBook-Pro:~ vdorneanu$ php -v
PHP 7.3.25 (cli) (built: Nov 30 2020 14:17:24) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.25, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.25, Copyright (c) 1999-2018, by Zend Technologies

MacBook-Pro:~ vdorneanu$ which php
/usr/local/opt/[email protected]/bin/php

That works fine when using php in the terminal. But ~/.profile is kind of ignored.

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

ok this is more a Homebrew issue, but basically you shouldn't have a need to update your PATH. by default on macs /usr/local/bin is already in the PATH, and this is where Homebrew is installing stuff. your /usr/local/opt are kinda strange too, you shouldn't have to deal with any of that.

the only thing i would have thought from your first message is that might need to link your [email protected] like this:
brew unlink php
brew link --overwrite [email protected]

try this.

worse case you could disable the platform check from the composer.json, but that's kinda hacky. but at the same time i'm not sure your brew environment is well set up.

@dorneanu
Copy link
Author

dorneanu commented Dec 2, 2020

I've logged out and retried again. Same error :( I even change the script to:

/usr/local/opt/[email protected]/bin/php src/app.php

But the workflow still seems to use the same php binary (the 7.1.3 one)

@dorneanu
Copy link
Author

dorneanu commented Dec 2, 2020

image

Changing the script in "time / Script filter" to :

/usr/local/opt/[email protected]/bin/php src/app.php "$1"

did the trick. but i think this is not a general solution :)

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

but you shouldn't have to change anything in the Workflow itself. the issue is that it seems (for whatever reason) that Alfred is calling PHP 7.1.

by default Alfred is set to use /bin/bash and the script is calling PHP. on your system, that PHP is 7.1 for whatever reason.

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

also, i've installed 7.1 and tried running Alfred Time. it runs without any issues. as said, composer shouldn't check anything as all the packages provided with the Workflow. are you trying to run a composer install or update somehow?

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

and do you have composer installed globally?

@dorneanu
Copy link
Author

dorneanu commented Dec 2, 2020

I had to disable the composer check:

composer global config platform-check false

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

well here is what's happening: you have packages installed globally that require PHP 7.3 minimum. probably you're using composer 2 which now tests requirements before dumping autoload and stuff. it seems you're using some commands (other cli tools?) that's doing something and composer is squeaking. one way to solve your issue might be to remove all your global packages, install PHP 7.3/7.4, add back your packages, do a composer global update.

i highly doubt that this is related to Alfred Time. again, if it was the case, you'd get a PHP parsing issue, not a composer one. the issue you're having is with your current system (still don't get why you use /opt. your available PHP version is in /usr/local/bin).

@dorneanu
Copy link
Author

dorneanu commented Dec 2, 2020

I've re-installed everything. Nothing worked. Whatever I do the new php binary is installed at /usr/local/opt.

Since Alfred seems to ignore ~/.profile, ~/.bash_profile etc. I think the best way at the moment is to set worklow environment variables for this specific one:

image

This way I don't interact with your code/script.

@dorneanu
Copy link
Author

dorneanu commented Dec 2, 2020

hmm... I think I've found the next issue:

[16:01:29.129] ERROR: Time[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 49

Notice: Undefined property: stdClass::$tag_id in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 40

Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 41

Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 49

Notice: Undefined property: stdClass::$tag_id in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 40

Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 41
{"items":[{"title":"Knowledge Sharing","subtitle":"Work\/Org, [], PT38M34S","icon":{"path":"resources\/icons\/clockify.png"},"arg":"do","variables":{"action":"continue","timer_id":"5fc794abf0585b4fc8c9ae8b","timer_description":"Knowledge Sharing","timer_project_id":"5fc7928603300602503149fb","timer_project_name":"Work\/Org"}},{"title":"Improve Alfred","subtitle":"Work\/Org, [], PT1M11S","icon":{"path":"resources\/icons\/clockify.png"},"arg":"do","variables":{"action":"continue","timer_id":"5fc793a6f0585b4fc8c9ad3f","timer_description":"Improve Alfred","timer_project_id":"5fc7928603300602503149fb","timer_project_name":"Work\/Org"}}]}

I'm using Clockify. And this happens whenever I try to continue on some existing task. After pressing COMMAND I don't see any list of tasks I can chose from.

Should I create a new issue for this one? :D

EDITED: This happens when there are no flags set for the specific tasks.

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

I've re-installed everything. Nothing worked. Whatever I do the new php binary is installed at /usr/local/opt.

Since Alfred seems to ignore ~/.profile, ~/.bash_profile etc. I think the best way at the moment is to set worklow environment variables for this specific one:

image

This way I don't interact with your code/script.

well, this is still weird. there's binaries in /usr/local/opt/... but they're symlinks. when you do a which php it should point to /usr/local/bin that should be in your PATH by default on macOS.

if you're fine your current solution then yes please close this one and open another issue. thanks. hope your setup is not gonna bite you back later then.

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

hmm... I think I've found the next issue:

[16:01:29.129] ERROR: Time[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 49

Notice: Undefined property: stdClass::$tag_id in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 40

Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 41

Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 49

Notice: Undefined property: stdClass::$tag_id in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 40

Notice: Undefined property: stdClass::$tags in /Users/vdorneanu/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FC7D3B94-728D-43AE-89FA-890B15606372/src/Menus/ChooseTimer.php on line 41
{"items":[{"title":"Knowledge Sharing","subtitle":"Work\/Org, [], PT38M34S","icon":{"path":"resources\/icons\/clockify.png"},"arg":"do","variables":{"action":"continue","timer_id":"5fc794abf0585b4fc8c9ae8b","timer_description":"Knowledge Sharing","timer_project_id":"5fc7928603300602503149fb","timer_project_name":"Work\/Org"}},{"title":"Improve Alfred","subtitle":"Work\/Org, [], PT1M11S","icon":{"path":"resources\/icons\/clockify.png"},"arg":"do","variables":{"action":"continue","timer_id":"5fc793a6f0585b4fc8c9ad3f","timer_description":"Improve Alfred","timer_project_id":"5fc7928603300602503149fb","timer_project_name":"Work\/Org"}}]}

I'm using Clockify. And this happens whenever I try to continue on some existing task. After pressing COMMAND I don't see any list of tasks I can chose from.

Should I create a new issue for this one? :D

EDITED: This happens when there are no flags set for the specific tasks.

yep, saw the debug info. can't reproduce here though. with project, no tag. no project no tag. project and tag.

https://share.getcloudapp.com/Jruq7GK4

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

did you start the tasks in Alfred? not that it should change anything, but it works here and there's automated tests. i'm afraid your weird set up is what brings more issues.

@godbout
Copy link
Owner

godbout commented Dec 2, 2020

how did you install the Workflow? packal? release from GitHub? did you run any composer install/update thing? (still that composer platform requirement thing is not normal)

@esseti
Copy link

esseti commented Jan 3, 2022

I've installed php 8.1.1 via brew.
when i type time i get this

10:58:00.987] ERROR: Time[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0. in JSON:
Deprecated: Return type of Adbar\Dot::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 510

Deprecated: Return type of Adbar\Dot::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 521

Deprecated: Return type of Adbar\Dot::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 532

Deprecated: Return type of Adbar\Dot::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 548

Deprecated: Return type of Adbar\Dot::count($key = null) should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 565

Deprecated: Return type of Adbar\Dot::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 581

Deprecated: Return type of Adbar\Dot::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 597

Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/guzzlehttp/guzzle/src/Client.php on line 445
{"items":[{"uid":"start_timer","title":"Start \"\"","mods":{"cmd":{"subtitle":"Continue a timer","arg":"choose_timer"}},"arg":"choose_project","variables":{"timer_description":""}},{"uid":"setup_timers","title":"Setup the workflow","arg":"setup","icon":{"path":"resources\/icons\/icon.png"}}]}

i've downloaded the workflow form github.

how should I start the workflow? what is the first command to trigger?

@godbout
Copy link
Owner

godbout commented Jan 3, 2022

sorry, Alfred Time doesn't support PHP8.1 yet. couple of packages i need haven't updated. you need to use PHP8. you can keep your PHP8.1 global and point the Workflow to use another install. link coming.

@godbout
Copy link
Owner

godbout commented Jan 3, 2022

see #46 (comment)

@godbout
Copy link
Owner

godbout commented Jan 3, 2022

should precise this in the README. will add. thanks.

@esseti
Copy link

esseti commented Jan 3, 2022

The error is not that PHP is not found is differnet.
it seems a problem with some json

JSON error: JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0. in JSON:
Deprecated: Return type of Adbar\Dot::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/stefano/Documents/alfred/Alfred.alfredpreferences/workflows/user.workflow.1B3CCDAC-EF47-4B92-B027-B696FEE4336B/vendor/adbario/php-dot-notation/src/Dot.php on line 510

what version of PHP should I use?

@godbout
Copy link
Owner

godbout commented Jan 3, 2022

it's a PHP version issue. PHP8.1 is sending warnings, which pollutes the JSON. you have to use PHP8. see link i sent above.

@godbout
Copy link
Owner

godbout commented Jan 11, 2022

I've re-installed everything. Nothing worked. Whatever I do the new php binary is installed at /usr/local/opt.
Since Alfred seems to ignore ~/.profile, ~/.bash_profile etc. I think the best way at the moment is to set worklow environment variables for this specific one:
image
This way I don't interact with your code/script.

well, this is still weird. there's binaries in /usr/local/opt/... but they're symlinks. when you do a which php it should point to /usr/local/bin that should be in your PATH by default on macOS.

if you're fine your current solution then yes please close this one and open another issue. thanks. hope your setup is not gonna bite you back later then.

i had no memory about dealing with that issue and answering those, but that was dumb 😂️ or i've learned something along the way. Alfred was using the PHP integrated with macOS even if you installed and linked another version from brew. made it obvious under Monterey...

@nathansnelgrove
Copy link

I'm going to hop in here and say I'm actually having the same issue again on a new laptop. I've installed Brew, installed PHP 8.0 PHP is installed on the machine (verified with php -v). I tried the same export PATH trick as I did last time, which I verified worked before, and I got nothing. I ran which php and copied the file path to use that as the new export PATH, and I still have nothing.

What's weird is when I type "Tim" in Alfred I see "Time Keep Tying..." as one of my options. If I select that option, Alfred gives me the UI to quickly google "Time ", rather than continue on with the workflow.

I'm a little mystified. This is the first Apple Silicon machine I've tried to set up the workflow with, though.

@godbout
Copy link
Owner

godbout commented Mar 26, 2022

can you paste the debug from Alfred? hard to know without any info. seems the workflow is crashing but that's it.

@nathansnelgrove
Copy link

So I grabbed that, and it looks like it's having trouble finding my version of PHP. I've tried everything I can think of, but no matter where I set the path to, I get this:

[09:42:10.105] Time[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.46543BE0-F37E-4D4B-9DB9-3DF6FD617101%3EED8CB5E9-49D7-421C-BBB5-17BD437A3260)] Queuing argument ''
[09:42:10.110] Time[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.46543BE0-F37E-4D4B-9DB9-3DF6FD617101%3EED8CB5E9-49D7-421C-BBB5-17BD437A3260)] Script with argv '' finished
[09:42:10.111] ERROR: Time[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.46543BE0-F37E-4D4B-9DB9-3DF6FD617101%3EED8CB5E9-49D7-421C-BBB5-17BD437A3260)] Code 127: /Users/nathan/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D3F51A87-E15A-4595-A062-8C0E0BE66427: line 3: php: command not found

I'm starting this computer from a clean install, so no cruft is carried over. Homebrew is the first thing I installed outside of the App Store (excluding 1Password), so to my knowledge, nothing is getting in its way.

I only installed PHP 8.0, and none of the other versions.

If I write which php and copy that path to the workflow, that does not work either.

Totally stumped. I'm sure I'm missing something obvious, but I have no clue what it is.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

@nathansnelgrove

Alfred was using the PHP integrated with macOS even if you installed and linked another version from brew.

screenshot incoming especially for you.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

can you try that?

Screen Shot 2022-03-28 at 21 53 44

@nathansnelgrove
Copy link

That's how I have it set now, actually. I'm still getting the same error.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

shit that's the same thing from your other issue 🤔

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

That's how I have it set now, actually. I'm still getting the same error.

ok stupid question but you did it for both scripts right?

@nathansnelgrove
Copy link

Not a stupid question at all. I didn't realize there were two scripts. I do have the second script set this way too, because it's the default. Maybe I should try the path I get from which php again and see if that works if I use it on both?

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

can you paste here the result of which php?
i'm flabbergasted too. if i were you i would return the laptop to Apple.

@nathansnelgrove
Copy link

/opt/homebrew/opt/[email protected]/bin/php

@nathansnelgrove
Copy link

nathansnelgrove commented Mar 28, 2022

I will add that changing both paths results in the script with that path still results in the same error, where PHP can't be found. (I'm also not sure how returning the laptop would help; if it's a software bug — even if it's a macOS software bug — a new machine won't do much.)

@nathansnelgrove
Copy link

Should the language be set to bin/zsh to match macOS defaults?

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

Not a stupid question at all. I didn't realize there were two scripts. I do have the second script set this way too, because it's the default. Maybe I should try the path I get from which php again and see if that works if I use it on both?

well ok my recent learning is that your macOS bash/zsh environment and the one from Alfred are different. so you have to tell explicitly Alfred where to get the PHP. i only realized this after Monterey removed PHP.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

Should the language be set to bin/zsh to match macOS defaults?

nope. wait coming with more.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

(I'm also not sure how returning the laptop would help; if it's a software bug — even if it's a macOS software bug — a new machine won't do much.)

NATHAN WHERE IS YOUR SENSE OF HUMOR!!!

@nathansnelgrove
Copy link

I'm only one cup of coffee in; it must be in the second cup...

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

for the first script, paste this:

export PATH="/opt/homebrew/opt/[email protected]/bin:${PATH}"

php src/app.php "$1"

for the second script, paste this (not the same):

export PATH="/opt/homebrew/opt/[email protected]/bin:${PATH}"

php src/app.php

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

I'm only one cup of coffee in; it must be in the second cup...

can you imagine all the people who commented on this thread before and are receiving our bullshit now?

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

for the first script, paste this:

export PATH="/opt/homebrew/opt/[email protected]/bin:${PATH}"

php src/app.php "$1"

for the second script, paste this (not the same):

export PATH="/opt/homebrew/opt/[email protected]/bin:${PATH}"

php src/app.php

if this still doesn't work i think you'll have to wait for me to get the Mac Mini M2 because i'm like you, i don't get it. except if Tim Cook decided to block my software because i'm so much of a djeenius.

@nathansnelgrove
Copy link

Those people would love it. I'd think it's hilarious.

Also, that worked! Pure wizardry. I remain indebted to you.

Can you explain why it works now for me? I'm specifically curious what /bin:${PATH} does, because I didn't think to try it and I don't understand it. I'm assuming it's looking for a path variable, but I thought we were setting that variable with this line of code? (I'm a pretty junior programmer, so I apologize if this is basic.)

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

Those people would love it. I'd think it's hilarious.

you have no idea the amount of complaints i have about my products being "unprofessional". (but they work perfectly and are very useful but i don't use uppercases at the beginning of sentences and also i fucking swear a lot.)

Can you explain why it works now for me? I'm specifically curious what /bin:${PATH} does, because I didn't think to try it and I don't understand it. I'm assuming it's looking for a path variable, but I thought we were setting that variable with this line of code? (I'm a pretty junior programmer, so I apologize if this is basic.)

is this possible that you pasted /opt/homebrew/opt/[email protected]/bin/php instead of /opt/homebrew/opt/[email protected]/bin?

also, you could actually in your case use directly /opt/homebrew/opt/[email protected]/bin/php src/app.php $1. the stuff with the PATH is for when one doesn't know it one is under Intel or under Apple silicon. btw that makes me think, Alfred Time should handle this by default without you having to touch anything... need to check.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

I'm specifically curious what /bin:${PATH} does, because I didn't think to try it and I don't understand it. I'm assuming it's looking for a path variable, but I thought we were setting that variable with this line of code? (I'm a pretty junior programmer, so I apologize if this is basic.)

yes, that line adds the /opt/homebrew... folder in the PATH, at the beginning. so that if there's several PHP found, Alfred will use the one from homebrew.

edit: no need to apologize. except for the beers we didn't have together in Toronto. i'm still waiting for the plane ticket.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

ok so this is the default in Alfred 4.3.0:

export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"

php src/app.php "$1"

in your case you needed /opt/homebrew/opt/[email protected]/bin/. honestly i'm not 100% sure why. i haven't had a M1 yet. i guess it's because it's a versioned formula, and i guess you haven't linked it? i think homebrew installs versioned formulae but doesn't link them by default. but at the same time the which php works. don't know man. just pretending here.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

anyways. have fun 🚀

@nathansnelgrove
Copy link

I mean, this product is basically a free gift to anybody who shares your needs and taste, so you could start dropping f-bombs right in the UI and I'd be good with it.

I definitely added the extra /php at the end there.

But FWIW, I also tried your second suggestion, and it didn't work. I got the same error where it couldn't find PHP. It was one of my many troubleshooting attempts on Friday night. ¯\(ツ)

@nathansnelgrove
Copy link

in your case you needed /opt/homebrew/opt/[email protected]/bin/. honestly i'm not 100% sure why. i haven't had a M1 yet. i guess it's because it's a versioned formula, and i guess you haven't linked it? i think homebrew installs versioned formulae but doesn't link them by default. but at the same time the which php works. don't know man. just pretending here.

I thought of this and I did link it as well on Friday evening, so you can rule that out. Whenever you get an Apple Silicon computer (or if you do), then I'd be curious what you find here.

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

I mean, this product is basically a free gift to anybody who shares your needs and taste, so you could start dropping f-bombs right in the UI and I'd be good with it.

yeah that's what i think too. probably i should just stop in the paid apps.

I definitely added the extra /php at the end there.

yes, so, cannot. it has to be the path that leads to the executables. not the executables themselves.

But FWIW, I also tried your second suggestion, and it didn't work. I got the same error where it couldn't find PHP. It was one of my many troubleshooting attempts on Friday night. ¯_(ツ)_/¯

huh. that is even stranger. but ok if it works now, better not touch it 😂

@godbout
Copy link
Owner

godbout commented Mar 28, 2022

in your case you needed /opt/homebrew/opt/[email protected]/bin/. honestly i'm not 100% sure why. i haven't had a M1 yet. i guess it's because it's a versioned formula, and i guess you haven't linked it? i think homebrew installs versioned formulae but doesn't link them by default. but at the same time the which php works. don't know man. just pretending here.

I thought of this and I did link it as well on Friday evening, so you can rule that out. Whenever you get an Apple Silicon computer (or if you do), then I'd be curious what you find here.

will definitely do. have and let you know. just waiting for a Mac Mini update. i like portable stuff.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants