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
Related
I am currently working on a PHP Laravel project. For this project I need at least PHP 8.1, so I have a PHP Docker instance. On my Mac I have php 7.3.24. The project runs as expected. But my IDE (VS Code) gives me an error message in many places due to the local PHP version. For example, the typehint of class variables.
In addition, included libraries are not recognised when I want to initiate them (undefined type).
My question: Do I have to upgrade the local PHP version or is there a setting in the IDE?
I import two different projects to PhpStorm. After that, like always I need to switch PHP version for project from 5.3 to 5.5. After doing this I saved project.
When I reopen this project I see that PhpStorm don't save this setting. I do this same operation again. But again, after reopen project I need to set proper version for project.
I check xml files in .idea folder and php version is there set to 5.5.0 . I check project.default.xml and there php version is set to 5.5.0 too.
I reinstall PhpStorm using JetBrains Toolbox but this doesn't change anything.
My OS is Ubuntu 14.04 . My project files are in my /home folder and user/group of this is www-data/www-data. My user is in group root/www-data/pmucha. There is no problem with edit files (no permission problem).
I use latest version 2017.3.5 of PhpStorm.
I can't find solution to this problem. Can someone help me ?
I'm really tired of setting PHP version every time I open project or start new one.
Do you have composer.json in these projects? Most likely yes.
Thing is: PhpStorm by default synchronizes some settings from composer.json file. It can sync your PHP Language Level as well as Source & Test roots.
Right now it looks like PHP version defined in composer.json is 5.3 or lower (5.3 is the lowest in PhpStorm) .. so PhpStorm resets your manually configured version to the provided one by composer.json. Such sync usually happens on project opening .. hence the feeling that IDE does not remember the settings.
https://blog.jetbrains.com/phpstorm/2017/07/configuring-with-composer-in-phpstorm-2017-2/
Two possible solutions:
Either put a proper minimal PHP version into your composer.json (if you are writing your code using PHP 5.5 features .. so what's the point stating the 5.3 as lowest supported -- such code will fail if run using 5.3).
For example (small part of composer.json):
"require": {
"php": ">=5.5",
...
}
Or disable such synchronisation at Settings/Preferences | Languages & Frameworks | PHP | Composer --> Synchronize IDE settings with composer.json
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 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.
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.