I have a folder with several subdirectories containing PHP files. At the moment I open each file individually in Netbeans. However, I would like to open this folder as a project, so I can use features like searching for a line throughout the entire project. Is this possible in Netbeans? What would be the best way to achieve this?
Create a new project, set sources directory to the one you have with current files
(might want to back up the files before if anything goes wrong).
Go in Netbeans. Select Files->New Project. A window will open, in that select PHP in Categories. Click Next. In Project Name give the name of your project(as seen in netbeans), in Sources Folder select the path to your project and click Next. In Run Configuration Make the settings according to your requirement to run the project. Now in PHP Frameworks Select ypur desired framework or just leave it blank and click FINISH.
You will See your project in Netbeans now.
Go to file->New Project and select PHP in category and follow the instruction.
In Source folder you need to choose your files folder so that it get listed.
go to FILE->new Project->select php in categories in left pane and php application with existing sources as Projects *in the right pane* ->next -> next till finish
When you add any directory in netbeans as a project, it add its only directory under the project directory. So if you need to add the numbers of directory in netbeans being a project, then i would like to suggest firstly to collect all directory in parent directory. then add it as a project.
Here is an explaination:-
directory- dir
lets you have dir1, dir2, dir3, dir4.
and according to you mentioned above all dir are projects.
You have to create a dirA and all dir1, dir2, dir3,and dir4 are subdirectory of dirA.
so the folder under dirA nbprojects(created by netbeans) will take care of all directories being the subdirectory of dirA.
Related
I am just noticing that there is a .phpintel folder at the top of the Laravel file structure. Where did it come from, is it necessary and can I gitignore it?
phpintel is a common sublime plugin. PHP code scanner and analyzer for code intelligence within PHP projects.
It creates .phpintel directory like .idea for Phpstorm and it should be included to .gitignore list of project and contains local project related settings and history for it.
You can ignore any hidden (and generated) data
You will find phpintel ignored in many .gitignore project file, such as:
postmark-php/.gitignore
Zizaco/entrust/.gitignore
...
Not sure how I can explain this better as I am a beginner to Eclipse application.
I have my web directory set up for php pages. For example, /home/www/phpsite. All the source files exist here.
However, whenever I create a project (say 'myProject') and test any files from the existing path, it includes the project folder in the path name:
/home/www/phpsite/myProject/index.php
and this results 'Not Found' error.
How can I run my php pages in /home/www/phpsite/index.php? The project folder name is always included in testing web pages.
I am not trying to use the workspace directory created by Eclipse. I'd like to code and modify pages directly from Eclipse to my web directory.
Thanks
Follow these steps:
Setup www as your workspace
From the menu: File -> Import -> General -> Existing Folder.....
Promote to project:
Choose project type: PHP
Browse for "phpsite" and finish.
I have a project with some php and html files. URL for this project, for exmaple, - mysite.com
I need to create a subdomain for content, that will be moved to CDN: assets.mysite.com
Now, during development time, all files for subdomain are stored in a subfolder of my project /home/user/phpstormprojects/mysite/assets
In my html/php files I need to specify full path to my assets
html://assets.mysite.com/mybest.png
Of cource I want autocompletion and other features to work well.
So I need to set up phpstorm smth like "assets.mysite.com" = "/home/user/phpstormprojects/mysite/assets"
Could I do it?
I am using PhpStorm 7.1.3
Ensure your cursor has highlighted the project name.
At the menu on top select "File" then "New" then "Directory".
Name your directory. It will go under the project name (see step 1).
Right click on the new directory then select "Mark Directory As" a
pop-up will appear giving you the option to mark the new directory
as "Resource Root".
Put whatever directories you want inside it. PhpStorm will rename all references to them in your code.
The directory structure of my project is like this:-
/var/www/includes/
/var/www/classes/
/var/www/public/css/
/var/www/public/js/
/var/www/public/index.php
The webroot is /var/www/public, so accessing the test domain localhost.dev would serve the files inside the public directory and hence would run /var/www/public/index.php. No need to access like localhost.dev/public/index.php
The problem is when I create the project in Netbeans, I have to set the index file so that the project can be debugged using xdebug and Netbeans.
So when adding the project I provided /var/www as Project source folder (Sources Folder) as the includes and classes are in this folder. In the next project configuration screen (Choose Project > Name and Location > file path is taken as Run Configuration), I'm asked for the Project URL and the index file. Since the index.php file is actually under the /var/www/public/, when I browse the file and select it, the url to index page is taken as localhost.dev/public/index.php instead of just localhost.dev/index.php. This is preventing me from debugging the project.
Can anyone please point out how to add projects to Netbeans when all the source files are not in web root and the project is to be debugged using xdebug.
I think its a bad practice to put all the project files directly in /var/www.
I think you will never see that in real deployed projects. So my first recommendation will be to change the way you are structuring your project. If that's not possible, in Netbeans select /var/www/public as the Project folder.
If Netbeans need references to the folders in /var/www, create symbolic folders inside public pointing to those in /var/www.
The last resource you have is to create a rewrite rule in Apache to make localhost.dev/public be the same as localhost.dev. You can look for this in Apache documentation.
I have a similar set up with one minor difference: my setup uses a remote site on my local development server. On the "Run Configuration" window of the project properties, I set "Run As" to "Remote Web Site (FTP, SFTP)". I don't think this affects the information in my answer, but I'm mentioning it just in case.
Go to the "Sources" window of your project properties, find the entry for "Web Root", click "Browse" and select the /var/www/public directory. That should cause xDebug to use localhost.dev/index.php. You'll notice when you go to the "Run Configuration" window and browse for the Index File that the browse window will start in "public" rather than "www".
An important note about this type of configuration that caused me a great deal of frustration.
When using xDebug, you'll want to be able to set breakpoints in and work with the files outside of the web root (public) directory. Because you've set the web root to /var/www/public, you won't be able to work with the files in /var/www/includes or /var/www/classes.
The thing you need to do is to add the files outside of your web root to the Global Include Path.
There are two methods for adding directories to your Global Include Path, which one you use depends on how you've configured your project.
In your case, the external directories are included in your project, so you need to add them via the "Options" interface. Go to Tools->Options and select the "PHP" tab, then add the /var/www/includes and /var/www/classes folders to the Global Include Path.
The other method for adding files to the Global Include Path is for files that are located outside of your project source folder. For directories like /var/folder_outside_www/, you use the "PHP Include Path" window in the project properties.
I haven't found a better way but I use this steps:
Menu:Project Properties -> Link:Run Configuration -> Button:Advanced
Debug URL, choose: Ask Every Time
Path Mapping, Server Path: http://localhost.dev/ ,Project Path: /var/www/public/
Now, when you start Debugging process, Netbeans will display Specify URL pop-up which you can change from http://localhost.dev/public/index.php into http://localhost.dev/index.php
Set /var/www/public as project folder (contain netbeans project folder) and include in project properties /var/www/includes/ and /var/www/classes/ as global include directories. Or best way use PHPStorm.
Is it possible, with or without plugin, to add more source folders to a PHP project, just like in a Java project?
I have downloaded and tested the Java version of NetBeans, and there is clearly possible to add more source folders. But not in the PHP version?
you can add paths for all newly created PHP projects from:
netbeans options > PHP section > Global include path
or you may add project specific include paths in a project's "project properties" (right click on a project in the projects view", and then choose "PHP Include Path" from the left side section.
although you are not allowed to edit a project included sources. you might as well create an additional project in Netbeans and call it like "my-include-path", then add all the folders in your desired include paths to this project. now you can edit your included files in this project.
When you right-click in the projects panel (Netbeans 6.9.1), there's an option 'Project Group'. This allows you to add the current projects (In this case the php and the js project) to be grouped and opened as one.
Also useful to automatically open additional projects used for reference.
Under project properties, the source folder is only one.
However, you could add folders to the PHP Include Path if you are trying to use files from another folder.
At this time, it looks like NetBeans PHP projects does not support multiple source folders.
I have added a feature request to the NetBeans' Bugzilla: http://netbeans.org/bugzilla/show_bug.cgi?id=180889
"Global include path" and "PHP include path" does not work for me.
My personal solution is to add the extra_path before the include/include_once statements in this way:
set_include_path(get_include_path() . '$extra_path);