IntelliJ PHP Application Losing Module after close - php

Not sure how to troubleshoot this problem. I have an IntelliJ Ultimate Edition, used in 64-bit, which I use for a PHP project with several modules. This project has 3 modules, but every time I close Intellij 11, when I open IntelliJ again, I find that the module has disappeared.
Steps that I have used to add this PHP module:
File->Add Module->Create Module From Existing Sources and I select the directory with the module.
or
File->Add Module_>Import Module from IML (I've tried importing the the module-level IML file for the disappearing module), but regardless of which I try, I still fail to retain the 3rd module on the restart of my IntelliJ and I end up having to add the module again.
Edit: A hack to get around this issue is to import the top level IML file into your project. IntelliJ will reorganize the project to show the entire tree structure of your folders.

PHPStorm handles this more effectively than IntelliJ Ultimate. I'd say, that's the only way it's not better than PHPStorm itself.
It's not intuitive, but what you need to do instead is create a new project in the directory containing your existing sources, and choose "Web Module".

Related

Netbeans does not find all my include_once paths

I've just imported a largish php project into NetBeans. Under the top directory I have "app1", "app2", "app3", etc. (each of which are mapped to a domain name), then a "shared" directory for (you guessed it) files used by all the apps.
In app1/route/Search.inc it has:
include_once "../shared/lib/search.inc";
But ctrl-B on this line does nothing. Makes sense, from NetBeans point of view of this as one large application, it should be "../../shared/lib/search.inc". But, for the way the apps are configured, the above is correct, and NetBeans is wrong.
How do I tell NetBeans it needs to go one extra directory up?
Under Include Path, I tried adding "/full/path/to/app1" (so then "../shared/lib/" would be found) (I tried Private tab, then Shared tab, with same results.) But it rejects that, telling me the app1 directory is already part of the application. There is no "Do what I say, and don't think about it, slap!" button.
Adding symbolic links in the file system, just for NetBeans, feels a bit ugly.
I'm wondering if I should make one NetBeans project per app? (I actually tried that first, but as all apps are in the same git repository it gave a lot of noise, so I assumed that was the wrong way.)
ADDITIONAL: I'm most interested in the answer to my last question - is it standard practice to keep each app as a separate NetBeans project, even if they are all in the same git repository?
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 1
Java: 1.7.0_79; OpenJDK 64-Bit Server VM 24.79-b02
Runtime: OpenJDK Runtime Environment 1.7.0_79-b14
(on linux Mint 17)
Make shure that all files of your project are in the project's include path (righ click project -> properties -> include path). Usually there is only the "global include path", which you configure in the NetBeans settings (e.g. to point to your PEAR directory). Add all directories which contain source code you want auto completion for to this include path. Hint: This include path has nothing to do with the include_path used in PHP itself.
I'm wondering if I should make one NetBeans project per app? (I actually tried that first, but as all apps are in the same git repository it gave a lot of noise, so I assumed that was the wrong way.)
Yes you should have different NetBeans projects if your apps are separate, and since they are on different domains, it sounds like they are pretty distinct.
One way you can reduce the noise level of this approach is to right click the other app directories and find the option to Mark directory as > excluded and it should disappear (and the files won't be indexed for autocomplete / search / etc).
I have no problems with such a scenario, if I only select the filename. Then NetBeans search for a file with this name in the whole project directory.
If I select the filename and the path, it does not work. Maybe that is your problem?
I have changed nothing else and it works like a charm.
there is a alternative way to set path i.e. via php.ini
add the following line in php.ini set path of
include_path = ".:c:\xampp\htdocs\project_name\your_include_folder_name"
restart the apache server

How to setup Netbeans Project for WordPress Plugin/Widget Development

I am wanting to locally develop a suite of WordPress plugins and widgets. My development environment consists of Windows v8.1, Netbeans v8.0.2 and XAMPP v5.6.3.
I've configured Netbeans and PHP to use XDebug. I've spent the entire weekend watching and reading various tutorials on setting up Netbeans IDE for developing a WordPress plugins/widgets.
Everything seems to be working at this point - I've been able to create new Netbeans projects by opening existing/installed plugins of my WordPress install. I am able to set breakpoints and trace through code. All seems to be working well, but I am puzzled regarding the 'proper' way to setup a new project.
Should a plugin/widget project somehow include the WordPress core files starting at .\htdocs, or should the root of the project be .\htdocs\wp-content\plugins\myplugin? In other words, should I be able to see .\wp-admin and .\wp-includes in my project tree?
My thinking is that Netbeans needs to somehow be able to read the core WordPress files to provide function reference during development of the plugin/widget and this would require including the WordPress core in my project, somehow.
Maybe my question is best asked this way:
What should the root project folder be set to for developing/debugging a plugin named MyPlugin?
and/or:
How are WordPress core files included/referenced in the MyPlugin project?
Anyone have a good step-by-step reference that would enlighten me on this?
I'm searching for this too, but here's how I set it up. I'm developing a theme (plugin would be analogous) so I have the theme source and NetBeans project files in a separate folder outside of WordPress folder, and outside of the xampp/htdocs actually. Then, I set the root of my PHP project to this theme source folder, and then using the Project Properties -> Include Path facility to allow NetBeans to include the WordPress folder, it will appear under Include Path in Project Explorer, enabling 'IntelliSense' etc. This way you can start a new NetBeans project per plugin/theme, basically, just including the WordPress core in each. Furthermore, I have NetBeans set up to copy the source files to the xampp\htdocs\mysite2\wp-content\themes\ folder on save and project load (set up in preferences). Here's a pic: NetBeans WordPress Setup
The best way I've found so far is to use a hardlink.
If I keep the files in Netbeans' project directory everything works. But Wordpress sometimes does not recognize that the theme is there. I.e. in some wp-admin menu's. But I'm able to display a Theme just fine.
I create the project as a php project in Netbeans.
Then link my (pubic html) folder from the Netbeans directory.
mklink /J C:\LinkToFolder C:\Users\Name\OriginalFolder
Use " quotes if your path has spaces
I use:
mklink /J "C:\xampp\htdocs\wptheme\wp-content\themes\themename"
"C:\Users\Probook 1\Documents\NetBeansProjects\projectname\public_html"
Then I setup the netbeans project to load an external page when I run the project. (See File => Project Properties=>Run Configuration)
I'll be looking into doing the same with plugins soon. Practically I can't see a reason this won't work for plugins too.
I want to try and see if Netbeans copes with the hardlink better than Apache does. (I.e. if I setup the project first then move the files to Xampp and create a hardlink in Netbeans' project directory. I.e. Projectname\public_html
(If anyone does it first let me know how it goes)
It's more important to me that Netbeans can backup and function. As long as I can display what I'm developing realtime.
AFAIK Netbeans can intergrate with Xampp to run it's debugging (Xdebug)

Zend Framework Tool - zf.php: command not found

I'm trying to install Zend Framework Tool.
I follow the documentation and when I run zf.php modules (as stated in the docs) I get zf.php: command not found
I found someone who was having a similar problem here - Could not open input file: zf.php
..so from that post I tried the alternative (from my project directory - /var/www/zf-tutorial) vendor/bin/zf.php modules and it successfully lists my modules.
Why is this inconstant with the documentation? Do I have to write out this whole path every time?
==
So next, when trying to CREATE a project using Zend Tool, naturally I feel I need to navigate out of the project directory to my all projects directory (/var/www)
So I try zf2-tutorial/vendor/bin/zf.php create project zendtest from there... and I get the error (seems strange anyway that I might run a script of another project to create a new one but I'm just trying figure things out for now):
Error: I cannot find the autoloader of the application.
Check if /var/www contains a valid ZF2 application.
OK, seems I need to be within my projects directory where I installed it? So, grudgingly I go back into my projects directory (/var/www/zf2-tutorial) and run it from there - which seems even stranger that I should create a project from within another project... but it seems to work, .. but no, as it puts it inside my zf2-tutorial directory as that is where I am (thought it might)
How do I use this tool? Ideally I'd like to install it once and have it available for ALL projects current and future. Is simply zf create projects too possible? zf.php ... just seems messy

IntelliJ Ultimate, Project shows only a few files and does not recognize php

I am imported my Project trough git, the project is a php project running on symfoy2.
However it seems that intelliJ does not recognize it as a php project and therefore only shows a bunch of files (static web files such as .js, images, ... )
I was wondering if there is a fix for this, i did the following already:
- Installed php, symfony2 modules
- I am running IntelliJ Ultimate
I removed the existing modules (in project structure settings) and added the web module, that fixed my issue

disable auto-building of specific directory

I have eclipse 3.7.2 to work on PHP projects that are on remote Linux servers that can be accessed by SSH.
I installed eclipse RSE (Remote System Explorer) and I used it to add a remote project and configured it as a PHP project.
best practices for Zend Framework 2 projects is to include the used Zend Framework version within the sources of the application, but what happens then is that whenever I reopen eclipse it tries to build the project and validate the entire zend framework directory.
how can I choose that the auto builder will ignore that directory since it's not something that I modify. in general I have no idea why it needs to validate that directory every time and it does not check for md5 on the directory content before trying to validate every time. but it this can't be fixed, i need to ignore the entire zend framework directory foom auto building.
using Eclipse 3.7.2 with PHP plugin.
using Zend Framework 2.0 beta4 with basically the skeleton application and modules that are provided from the zend framework site.
thank you! :)
In the latest ZendSkeletonApplication, you'll see in index.php that you can place ZF2 outside of the project as long as you set the ZF2-PATH environment variable.
it seems that it's possible to do that.
i just need to right click on the directory i want to exclude from auto-building.
then to go to Build Path => Exclude.
this excludes the directory from auto-building and resolves the issue.

Categories