I'm editing a PHP file in Netbeans that is not part of a project. Although I have PHP 5.3 installed, Netbeans complains about my use of a lambda function: "Language feature not compatible with PHP version indicated in project settings".
Is there a way to tell Netbeans to think in 5.3 when I don't have project settings to edit?
I'm using Netbeans 7.0 with PHP 5.3.3 on Ubuntu.
UPDATE: The code is working, it's just the inspection that is borken.
Right click your project in the Projects tab, click Properties, then on the Sources tab, set the PHP Version. I'm using Netbeans 7.1.2
Go to File Menu of net beans and select project properties of the project and change the version of php from # PHP Version : PHP 5.6 or another.
This Error Showing for PHP version(language feature not compatible with php version indicated in project settings)
I recently did an update to my NetBeans (v7.0.1). I just tried creating a lambda fn and the IDE didn't show any warnings/errors. Try updating your NB.
Related
Eclipse for PHP Developers
Version: Oxygen Release (4.7.0)
Build id: 20170620-1800
How can I change the PHP Language Library to PHP 7 (see screen below)? The project results from a previous eclipse version which has been imported to Oxygen. On my machine no PHP is installed, I use Xdebug with a Linux VM, the workspace is on a samba share on that VM (runs PHP 7.0 on Apache).
In the preferences I can add PHP paths, but I have no access to the PHP directory on the Linux VM. But when I create a new PHP project in eclipse, I can select a PHP version (including 7.0).
I wonder if it is the only chance to create a new PHP 7.0 project and copy my files over, or is there a way to alter the PHP 5.6 to PHP 7.0?
Edit: based on howlger's answer
Yes, PHP validation solves it.
I was looking under Validation where is no such thing
Right-click on the project folder and choose Properties
In the properties dialog, in PHP > Validation
Enable project specific settings
As PHP Version choose
7.0 (uniform variable syntax, scalar type hint,...) or
7.1 (void return types, class constant visibility,...)
You also might configure installed PHPs: Window > Properties: PHP > Installed PHPs
See also PHP help: PHP Interpreter Properties
I would like to update the versions of php available in Netbeans 7.1 (I know it is only for hints),
I have php 5.4 working in my pc, but in netbeans I have available only php5.3 and 5.2, I would like to have 5.4 too
https://prnt.sc/fqxyoo
*I can not update netbeans because from 7.2 to 8.x it crashes inmediatelly after starting, but that is another history, so I would like only how to add php5.4 in netbeans 7.1
Thanks
Check your php version with the help of phpinfo(). But netbeans does not bundle the php. Check in php download url and download what you want.
I am using eclipse oxygen for php developers, trying to run php project with version 5.6.
Installed php version: 5.6
PHP version in project facets: 5.6
I tried to follow the the below tutorial, however I could not find php -> interpreter in neither project level nor workspace level.
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.wst.server.ui.doc.user%2Ftopics%2Ftwinstprf.html
How to resolve module(project?) version complaint?
I run in the same problem when I tried to run/debug a PHP project via Run As -> Run On Server.
Since you have not developed in detail your case I will try to present my case such that you might understand what might cause the problem and how to fix it.
So what I did was to choose the Run -> Run As -> Run on Server menu when a wizard-like dialog box was shown. I choose the PHP's Built-in Server, specified a PHP installed executable (like 5.6) then in the next screen ("Modify the resources that are configured on the server") by trying to move my project from the "Available" list to the "Configured" list I've got a notice error like the one you mentioned in the title. In my case the project was configured with PHP 7.1 while the PHP executable chosen in the "Run on Server" dialog box was 5.6, thus the conflict.
So the problem is that your project is defined to be validated by one PHP version while you are trying to run/debug it with another PHP version. What you can do to fix this is one of the following:
either choose a PHP executable for your "Run on Server" session that is compatible with the project's PHP version; this can be done easy right in the "Run on Server" screen .
either configure your PHP project to be validate by the same PHP version as the one you are trying to run/debug your project with; this can be done by right-click the project -> Properties -> PHP -> Validation then choosing the right PHP version
I hope it helps.
I just downloaded xampp(7.0.8) from xampp download page and installed with no error but when I create a new project in Netbeans it shows only 5.4 as the highest php version whereas what I have is php7. I tried with xampp 5.6.23 and still Netbeans did not show php5.6.
What's happening? How can I make Netbeans show php7 or php5.6 . I have xampp for both versions.
Netbeans 8.2 Will support PHP7 (http://wiki.netbeans.org/NetBeans_82)
You can download nightly builds version 8.2
http://bits.netbeans.org/dev/nightly/latest/
When creating a project in Netbeans, make sure to select the right PHP version on step 2 in the wizard. I know this question is a old one, but I came here since my older project was created on 5.6. To change a current project, open your project properties and on the Sources categorie change the PHP Version to the version you want to use.
To make clear. It does not matter at all what XAMPP you install. This setting is used for the hints in the editor. The final location of your project where it runs in the webserver has nothing to do with Netbeans at all.
Unfortunately the Netbeans still doesn't support some PHP7 syntax features like the typed properties.
E.g.
Class Foo { public int $bar }
shows a syntax error hint because of the "INT" attribute of $bar property despite that is allowed by PHP7
Other e.g.
public function foo(?int $bar){}
also shows syntax error due to the question mark.
I wish they will publish an update or even a pack.
Use Sublime Text instead of Netbeans, I mean if you just want to use netbeans to work with PHP, Sublime Text is better, just a suggestion.
I have the latest version of MAMP installed but i want it to run PHP version 5.4.
That version is included in the MAMP file dir. It is located…
-> bin/php/php5.4.42
but in the preferences pane there are only 2 PHP version options: 5.6.10 and 7
I want to do this a part of troubleshooting. i have a Drupal install and am getting the dreaded ‘White Screen of Death’. I’m trying anything and everything to get it working!
MAMP lets you choose from the last two versions of PHP installed in bin/php. If you want to use 5.4.42, just leave this folder and another one of your choice inside this directory (move the others somewhere else so you have a copy, just in case). When you restart MAMP you'll be able to choose your preferred PHP version in the Preferences.
You can download more versions at https://www.mamp.info/en/downloads/
The easier way is to use other localwebserver called Ampps, and after installing it you can choose the version you want by the simple interface it provide.
You click on PHP ==> Change PHP version, and it will show you versions from 5.3 to 7.0.
Here is the link: http://www.ampps.com/
Thanks a lot.