7

I'm currently developing a PHP web application which uses Yii framework.

As I want to prevent direct access from web browser to some files required by Yii, I moved both framework and protected folders outside htdocs folder.

As a result, I ended up with the following folder setup:

/apache22/htdocs

/apache22/htdocs/myproject/index.php -- Yii bootstrap file
/apache22/htdocs/myproject/css
/apache22/htdocs/myproject/js
/apache22/htdocs/myproject/images

/apache22/vendor/yii-1.1.10 -- Yii framework folder outside documents root

/apache22/htdocs-private/myproject/protected
/apache22/htdocs-private/myproject/runtime

As you can see, only the bootstrap file and some other required css, js and image files are available to be accessed directly from the web browser. All other files such as Yii core framework and specific application private files generated by Yii inside protected and runtime folders are located outside my application web root.

While this setup is fine and secure as recommended by Yii framework, when putting all of them together in Netbeans I'm unable to have this separation. It seems Netbeans does not allow me to have files in the same project located in different folder levels in my webserver.

I'm wondering whether or not the only solution would be to create separate netbeans projects: One for the public website part and the other one for the private website part.

Any suggestions ?

Best Regards.

User1988
  • 1,747
  • 4
  • 24
  • 47
edilima
  • 73
  • 1
  • 5
  • Also take a look at the answer here: http://stackoverflow.com/q/6263902/545925 . – adamors Jul 06 '12 at 12:19
  • @Örs Thanks for your replies. Well I forgot to mention that I'm currently using Windows 7 platform. I also checked your suggested link but my issue is that I also want to be able to edit all files in NetBeans as they are not necessarily an external library. In fact all files are part of the project. – edilima Jul 06 '12 at 13:56
  • @Örs Oh ! I got your point ! I found how to create symlink on Windows so I will do some experiments here and then let you know. Thanks a lot ! – edilima Jul 06 '12 at 14:08
  • 1
    With that folder structure you should add /apache22 folder as project root. I use folowing folder structure and it works great:`sources/app`, `sources/framework`, `sources/app/www`, where only `sources/app/www` is public –  Jul 12 '12 at 11:55

2 Answers2

2

Although it may only be a partially solution to your problem, you could add an additional include path to your project.

Assuming /apache22/htdocs/myproject/ ist your project folder.

  • right click on project name
  • select "Properties"
  • select "PHP Include Path"
  • click "Add Folder..."
  • add /apache22/htdocs-private/myproject/

It should now appear in the left sidebar under "Include Path". But it looks like you're not able to commit from there.

schmunk
  • 4,607
  • 1
  • 25
  • 48
0

I have this path structure:

NetbeansProjects/myproject/www NetbeansProyects/myproject/protected

That is completely outside of the web server path. Then when I want to test my code, I use a simple shell script (it could be a .bat on windows) that copies the files to the places they need to be. So by pressing F6 when I want to test, it all gets "deployed"

To be able to do this trick you should configure your project to execute your "deploy script" on the "Run Configuration". Here's mine, I'm sure you can adapt it for windows:

Run as: Script (run in command line)

PHP Interpreter: /bin/bash

Index file: up_sync.sh

Working directory: /home/user/NetbeansProjects/myproject/

Where the up_sync.sh file would be your .bat file which will copy the directories to their respective places.

AntonioHS
  • 1,270
  • 9
  • 25