5

Each time I save my .php file in Sublime this pops up:

Can't find PHP binary file at { "php_bin":"/usr/local/bin/php" }

I've done everything I know, so far I'm doing research for the answer.

2
  • what do you get from typing php -v in the console/terminal ? Commented Sep 25, 2017 at 9:25
  • PHP 5.6.30 (cli) (built: Feb 7 2017 16:18:37) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies Is what i get Commented Sep 25, 2017 at 10:55

3 Answers 3

8

For me it was phpfmt extention that could not find php.

In Sublime Text > Preferences > Package Settings > phpfmt > Settings - Default it showed:

{
"version": 4,
"php_bin":"/usr/bin/php",
"format_on_save":false,
"option": "value"
}

I did a which php in my terminal and it displayed /usr/local/bin/php So my php is not in /usr/bin/php

To change this I opened
Sublime Text > Preferences > Package Settings > phpfmt > Settings - User
to set my personal preferences.

{
"php_bin":"/usr/local/bin/php",
"format_on_save":true,
}

Saved that and t was fixed. No more pop-up, and formatted on save.

Sign up to request clarification or add additional context in comments.

3 Comments

Exactly the fix for me, except I'm on MacOS 13.4 (Ventura) which doesn't have a built-in PHP, so my path was /opt/homebrew/bin/php.
@DavidRhoden Sure, which php will tell you where your php is. With homebrew it can be in /opt/homebrew/bin/php ... today :) ... Another new issue can be that pmpfmt does not like your version of php. I think there is an update for ST4 php8.x
Great, it works. thanks
1

Make sure that you have right path on php. To find out enter command line

which php

if the result is

/usr/bin/php

place the above path in the sublime configuration

1 Comment

You place, /usr/bin/php in the config ?
0

If you're on Linux, you can also run this to find any binaries called php in your system, even if it's outside $PATH:

sudo find -type f -name php -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.