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

"PHP7 runtime not found. " Error Dialog #14783

Closed
leeuwtjex opened this issue May 7, 2019 · 10 comments

Comments

@leeuwtjex
Copy link

commented May 7, 2019

-Windows 7 / windows 10 (64 bit versions.)

-Using Wamp or Mamp environment in cooperation with Brackets.

-The issue started after accepting the 1.14 update yesterday. It occurs on several
laptops running different windows versions 64 bit.
After accepting the auto update of brackets 1.14 ,brackets started sucking a lot.

-symtoms:
An error pop up comes up after starting brackets.
"PHP runtime not found. Install the PHP 7 runtime and update "executablePath" in PHP preferences appropriatly.....blah blah... "

What I tried:

-modifiying defaultpreferences.json, preferences.json
-changing extension_dir ="c:/wamp/bin/php/php7.2.14/.php.exe" or
to: extension_dir ="c:\wamp\bin\php\php7.2.14\php.exe"
-renaming all config files in "C:\Users\user\AppData\Roaming\Brackets....."
and remove and reinstall brackets completely (purge similar like)
-adding a environment variable for PHP in windows as some forums suggested...
-and offcourse: clicking the "open preferences" button in the error pop up as suggested in brackets 1.14....

It still sucks.

I was not happy since I am working on a exam in a student project.
I realise I can use it for free, but please test out your stuff, before suggesting auto updates.

How can I stop this annoying error? I put 2 hours of time in it. The other students here like to learn to. Thanks in advance.

D.
brackets1 14

@shubhsnov

This comment has been minimized.

Copy link
Collaborator

commented May 7, 2019

In Brackets the preferences are set in brackets.json not defaultPreferences.json. The defaultPreferences.json file is not recognized. It's there just to guide the user about different preferences available.

  • Go to Debug > Open Preferences File

Assuming "C:\\wamp\\bin\\php\\php7.2.14\\php.exe" is a valid php path, paste the following in brackets.json. It should stop showing the error.

"php": {
        "enablePhpTooling": true,
	"executablePath": "C:\\wamp\\bin\\php\\php7.2.14\\php.exe",
	"memoryLimit": "4095M",
	"validateOnType": "false" 
}

Note: Also make sure brackets.json doesn't have any comments, since comments in JSONs are not allowed.

Click here to know more about the PHP support in Brackets.

@leeuwtjex

This comment has been minimized.

Copy link
Author

commented May 7, 2019

Hi Shubhsnov,

Thanks for the quick answer! I tried to follow your instructions.
The result in my brackets.json lookes like this:

{
"brackets-eslint.gutterMarks": true,
"brackets-eslint.useLocalESLint": false,
"fonts.fontSize": "16px",
"fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace"
}

"php": {
"enablePhpTooling": true,
"executablePath": "C:\\wamp\\bin\\php\\php7.2.14\\php.exe",
"memoryLimit": "4095M",
"validateOnType": "false"
}

I pasted your mods behind the default content in the file.
After restarting brackets it gives a "not valid JSON' now....
As far I can see I there are not any comments in the file, as you mentioned.

For experimenting I tried also: c:\wamp\bin\php\php7.2.14\php.exe
and removing the ""php": " part.
Didn't work either. What are those \ double slashes for?

@shubhsnov

This comment has been minimized.

Copy link
Collaborator

commented May 7, 2019

Ah! That's not how JSONs work.
A valid JSON will always have the form:

{
    "key" : value
}

Where key will always be a string and value can be any primitive value like number, string, another valid JSON object, or array of valid JSON values or objects.

Multiple keys are separated by comma:

{
   "key1" : value,
   "key2" : value2,
   "key3" : value3
}

In your case you have to add the modification inside the {} for it to be a valid json, like this:

{
    "brackets-eslint.gutterMarks": true,
    "brackets-eslint.useLocalESLint": false,
    "fonts.fontSize": "16px",
    "fonts.fontFamily": "'SourceCodePro-Medium', MS ゴシック, 'MS Gothic', monospace",
    "php": {
        "enablePhpTooling": true,
        "executablePath": "C:\\wamp\\bin\\php\\php7.2.14\\php.exe",
        "memoryLimit": "4095M",
        "validateOnType": "false"
    }
}

Also note that the hierarchy of keys should always match that of defaultPreferences.json, the values may differ.

In future, you can check the validity of JSON on https://jsonlint.com

As for \, in Windows the path separator is \, but a single \ is used as an escape sequence in strings for characters like \n (newline) or \r (carriage return). So to denote a single slash in strings we use double slash.

@leeuwtjex

This comment has been minimized.

Copy link
Author

commented May 7, 2019

The error has disappeared instantly!
Thanks for this! I'm sure many other users like it to.
I'm trying some other things now, but it looks good.

Just why isn't this handled in the default config after installing 1.14
on a windows system?

@shubhsnov

This comment has been minimized.

Copy link
Collaborator

commented May 7, 2019

Just why isn't this handled in the default config after installing 1.14
on a windows system?

It is handled. We try to figure out the default PHP7 executable path on installation. In case it's not present, then as soon as you open a PHP file we prompt the error dialog, which then means that you will have to set the PHP path manually like this instance.

By the way, are you using Brackets to write PHP code? Because this dialog should only come in case if the users are working with PHP files.

Do let us know in case there are any other issues.

@shubhsnov shubhsnov pinned this issue May 7, 2019

@leeuwtjex

This comment has been minimized.

Copy link
Author

commented May 7, 2019

Yes , we write php. Further I have only 3 extensions installed.
Emmet, Reverse Emmet and Run script. Just in case it is useful for you.

Will the default PHP7 executable path work, if users program on WAMP/MAMP/XAMP
GUI local webservers? (like this site shows: http://www.wampserver.com/en/ )
Wamp installs a php7 version by default in c:\wamp, like you can see in the config file I use now...
Thanks for this support.

@shubhsnov

This comment has been minimized.

Copy link
Collaborator

commented May 8, 2019

@leeuwtjex

Will the default PHP7 executable path work, if users program on WAMP/MAMP/XAMP
GUI local webservers?

If the error is gone, and the PHP7 path set correctly then you should get all the features working.

You can look here to know how to use the PHP features in Brackets

@leeuwtjex

This comment has been minimized.

Copy link
Author

commented May 8, 2019

Thank you, but I think we misunderstood. About the (WMX)AMP GUI .
In your answers yesterday I understood that since 1.14 Brackets will check the php installation ,and it is a new function. So, I thought that if brackets from now on will check " the default PHP7 executable path installation" first thing after every startup of the application, (WMX)AMP users will get into problems after every fresh installation of brackets, since (WMX)AMP doesn't use a default PHP location when it installs PHP for the (WMX)AMP system. If so, maybe it would be an idea to make an extra installation checkbox for Brackets, saying "Do you intend to use Brackets in cooperation with any of the following local webserver types like WAMP,MAMP or XAMP? " The user could have an option then to adapt to the correct php installation path. Just an idea. Thanks for all help!

@leeuwtjex leeuwtjex closed this May 8, 2019

@shubhsnov shubhsnov referenced this issue May 10, 2019

Open

PHP7 Runtime error #14785

0 of 3 tasks complete

@shubhsnov shubhsnov changed the title windows version update 1.14 => "PHP runtime not found. " "PHP runtime not found. " Error Dialog May 12, 2019

@shubhsnov shubhsnov changed the title "PHP runtime not found. " Error Dialog "PHP7 runtime not found. " Error Dialog May 12, 2019

@Vaibhav227

This comment has been minimized.

Copy link

commented Jun 11, 2019

i have made a video on it which perfectly suits your question. you have to install php runtime on your pc. click on the link below

https://youtu.be/P30t9gK4ZKQ
https://www.youtube.com/watch?v=P30t9gK4ZKQ

@madurasnvrtn

This comment has been minimized.

Copy link

commented Jul 29, 2019

Try this method

https://www.youtube.com/watch?v=HoIkCeuBUng&t=1s

Steps:

  1. Copy the php path from your computer (ex: - C:\wamp\bin\php\php7.3.5)
  2. Go to start menu and type “Advanced System Settings and press enter”
  3. Click on “Environment Variables”
  4. Select “path” inside the system variables and click “edit”
  5. Click on “new”
  6. Paste the path which you copied earlier and click on ok.
  7. Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.