Symbolic Links in Windows with PHP project using Netbeans 7 - php

I'm working on a PHP project and using Netbeans 7.0.1 and the last PHPUnit.
The project has two folders each one with its own bootstrap.
Let's say folders are project1 and Common, then project1 uses a SymbLink to access Common and in Mac world that works, but now I'm working on windows and from project1 unit tests, Common files are not found.
I tried to add Common folder as Global Path in Project1, but it still doesn't find Common files.
Is there any place where I can configure Netbeans to work?
Thanks in advance. Guillermo.

It's been a while since I've used this tool, and it might depend upon which version of Windows you're running, but you might also look into a tool called Junction Link Magic. It does symlinks on Windows, or some version thereof.
That being said, relying on symbolic links in the manner you're describing seems non-portable at best. My stronger recommendation would be to fix your build script (ant/maven/whatever) so that it works everywhere without relying on symlinks in the first place.

Your best bet is to add the Common folder to your include path. Otherwise, you can always just copy and paste the actual folder (not recommended).

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

Trouble Creating First Yii Application

Here is where I'm at. I am running MAMP on my Mac, and I have Yii in my htdocs folder. I don't understand the yiic.php part of it. I got it working once after numerous tries, but I the folder structure wasn't how I wanted it. So, with my folder structure being:
yii
framework>
requirements>
Where exactly would I navigate to in the Terminal, and what would I type. I've been navigating into to Applications/MAMP/htdocs/Yii and then once in there running this command:
php framework/yiic.php webapp testdrive
After that I get the Yes/No question, run "Yes", it does its thing, and I get this folder structure:
yii>
framework>
requirements>
testdrive>
assets>
css>
images>
index-test.php
index.php
protected>
themes>
Then I navigate in my browser to: http://localhost:8888/yii/testdrive/ and I get nothing...any idea what I am doing wrong?
Any help will be much appreciated! :) Thanks!
This is a long shot, but make the Y in yii a capital letter. This is assuming that the directory Yii does indeed have a capital Y in it. Unix/Linux machines have case sensitivity when it comes to these sorts of things.
As for your directory structure, you can have the Yii framework files live outside of your web folder if you want to. The "testdrive" directory is all you need inside of the htdocs folder. That said, the framework files can live in the folder as well, but it's generally considered insecure.
I got the same problem, but I am sure that I did not delete any file there. Fortunately, I try to restart apache server, and I revisite my test website, and it is working.
I use MAMP on Mac Lion. Hope this information would be helpful.

Eclipse PDT, how to setup 'Run Configurations'?

Eclipse PDT is very slick, but here's my issue, Re: Launcher (run configurations)
I'm trying to keep things very clean, concise on my local machine (with WAMP stack) and I have a number of virtual hosts configured, that keep my URL's easy to use.
In eclipse, I set up PHP servers to correspond with these Vhosts.
Since I have existing code, I'm usually setting up a new project 'from existing sources'.
Then when I try to 'run', I get URL auto-generated like this; with the Project name in it:
http://MyVhost/MyProj/testing.php
And what I really want is:
http://MyVhost/testing.php
I find myself doing a lot of editing and adjusting of the servers and run configurations, before I can get the URL that works. Any recommendations ?
You can create a new Run Configuration Run->Run Configurations and as long as you have setup your virtual hots as servers, you can untick 'Auto Generate' option under URL and enter you URL manually for each project. So even if you point to different files in your project, it won't matter because Eclipse will use your manually entered URL. Save these and then you're done!
The path part of the autogenerated URL is the Base Path (which defaults to / + project name) + the path of the file inside the project location. You can set the Base Path to / in Project | Properties | Debug . It applies to Run configurations as well. If you always use the documentroot of the site as the project location, it will work.
I ran across something similar where if I had a vhost named "test" I wanted to run everything for that project as...
http://test/<whatever_else>/
Here is my 3 step how-to to solve it, though I am not sure of any unintended consequences other than zend debugger not working.
From Eclipse, go to Windows/Preferences
Go to PHP/PHP Servers
Change Default PHP Web Server from http://localhost to http:/
The project will append the second slash and your project name if you just let it auto-generate.
Hope that helps someone. Helped me a ton.
You can modify the org.eclipse.php.server.ui plugin to get it the way you want.
Use the Plugin devlopment perspective of Eclipse to modify the plugin. The dialogs are available in
/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/launching/PHPWebPageLaunchShortcut.java
/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java
https://vsubhash.wordpress.com/2013/01/26/fix-for-url-auto-generate-bug-in-eclipse-php-pdt-plugin/

SVN Web Development - Path / OS Differences

What is the best way to deal with config / directory / OS differences using SVN to develop and deploy on 2 different platforms?
I am developing in Windows and deploying to Linux.
I'd like to use my home PC to test the files before using commit, I'm using a web framework and you must specify the paths to your system and application files for the framework. Obviously those are different on the 2 machines.
I have the option of using a linux server at home, as a last resort. I really like working with SVN using a GUI right now since I am new to SVN web development.
So what would be the best solution to config differences between my development and live servers?
There has got to be an easier way then changing the file everytime I commit it to the live server, which is really against what SVN is trying to accomplish in the first place.
One option is to keep the configuration files out of the repository - set them up on their own for both your local and server machines, and then don't touch them again unless you have to. (Using the svn-ignore: property can keep you from accidentally adding the config files to the repository later on.)
Another option is to try to use relative paths and then have the config/etc directories be in the same relative location to the working directory, even if they're not in the same absolute locations.
You can set a svn-prop (property) to ignore the config file. Forcing you to create one (manually or generated) specific to every installation.

Can projects using PHP framework operate standalone?

I am interested in the PHP framework, especially by symfony and ZendFramework, but I am not sure of one thing: I saw the need to type command lines to create a project with these frameworks. Ok, but once the project is finished, is it possible to move files to another server without installing anything (except for Apache)?
Thank you in advance
Ps: No report, but do StackOverflow uses a framework?
It is absolutely possible to run a symfony or zend framework application without installing the framework on the server. Symfony has a special mechanism to pack everything into one folder. If you use zend framework you basically have to copy the "Zend" folder to your "lib" directory and you are ready to go.
As far as I know, StackOverflow is build on ASP.net and C# running on several windows servers.
Firstof, most of those commands are needed for development only. But also you do not have to have the commands in your global path, it's also possible to execute the scripts directly.
In case of symfony that would be something like
./symfony-framework/data/bin/symfony
if you installed symfony to symfony-framework.
I believe stackoverflow is based on .NET MVC or plain ASP .NET - http://meta.stackoverflow.com will give you that answer
With Zend Framework, it is possible. The Zend_Tool part, which sets up the basics of your project is just addition. You can, but you don't have to use it at all. You can just write the project from scratch yourself, just stick to the standard project architecture.
Anyway, once the project is ready, it does not need any command line setup, other than mayby setting correct file system permission if your project needs to write some files.
I can't say about symphony, but I assume it also can be just copied to the target server.
I don't know, how about ZF, but project made with Symfony can be easily moved to another server just by copying files. However it will be difficult to maintain your project without commands. Also you have to copy all Symfony's core files to your server, but it will be better to install Symfony there before.
About Symfony:
Usually, you develop locally on your dev environment (using Wampserver or MAMP for example). You will require access to the command line to run symfony commands, specially for complex tasks like ORM tasks. So you have to install symfony on that environment.
According to the official doc the recommended installation method is through SVN (either the trunk or a tag) inside your project folder.
When you'll push the files from your dev environment to another (using project:deploy if you can), all the required files will be pushed.
So there is no need to install (in the sense of "run" or "execute") anything on the live environment server. The only "installation" method that requires an access to the command line is the PEAR install method, which is not recommended.
The only problem that I had when I deployed an application was a user permission problem on the cache folder, but that's easy to fix by changing the folder permission.

Categories