Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 3 Error: Warning. PHP 5.6 or newer is required. Please, upgrade your local PHP installation

I started getting this error in Sublime Text 3 when saving files:

Warning. PHP 5.6 or newer is required. Please, upgrade your local PHP installation.

I am using Sublime SFTP as well. I am not using local XAMP environment but did install php 5.6 on my local machine (MacOSX) to try and fix the problem. I also reinstalled all packages related to PHP, but the error persists.

like image 428
logic Avatar asked Jun 24 '15 08:06

logic


3 Answers

So I ran into this same issue on my computer, but the thing is I most definitely have PHP 5.6 installed:

php -v

After looking at the phpfmt package's default settings I notices a commented out line:

// "php_bin":"/usr/local/bin/php",

It looked like a way of hardcoding the path to your php binary.

I installed php 5.6 via homebrew so I knew the binary was stored in an atypical location, so I:

  • Copied the commented out line
  • Opened my User specific settings for the phpfmt bundle
  • Pasted it in
  • Uncommented the line
  • Got the path to my 5.6 binary via the command which php
  • Pasted that path in to my user settings
  • Saved

No more error and the package still formats per psr standards.

So, just for clarity, my User specific settings for the phpfmt bundle:

User settings

Look like this:

{
    "psr2": true,
    "version": 1,
    "php_bin":"/usr/local/opt/php56/bin/php", // change this path to whatever the path to your local php 5.6 binary 
}
like image 91
Chris Schmitz Avatar answered Oct 16 '22 18:10

Chris Schmitz


Thanks for pointing me to the right direction @hungtd. I tried

"php55warning": false
"php56warning": false
"php55compat": true

but none worked.

The solution I found was this: manually edit phpfmt.py file (Sublime Menu > Browse Packages > phpfmt) and comment out line 230:

# sublime.message_dialog('Warning.\nPHP 5.6 or newer is required.\nPlease, upgrade your local PHP installation.')

No more dialogs on saving :)

like image 37
logic Avatar answered Oct 16 '22 20:10

logic


Click on Menu > Preferences > Browse Packages

Then you will find "phpfmt" Folder. You will find "phpfmt.py" file in that.

Comment following lines ( Probably Line no: 745,746,747)

if err.decode('utf-8'):
    ret += ("phpfmt (php version) err:\n"+err.decode('utf-8'))
    ret += "\n"

And it Works!

like image 2
Devang mehta Avatar answered Oct 16 '22 19:10

Devang mehta