Discussion:
How the hell does the ftp works in netbeans ?
BigGhost
2011-11-23 11:26:05 UTC
Permalink
Hi,

something does not work properly. First of all my system:

NetBeans 7.1 Beta with JDK 7 (64Bit) under Windows7 (64Bit)
with "netsh advfirewall set global StatefulFtp disable"

Szenarion (short term):

1. Create a new PHP App from Remote Server
2. Setting the Initial Directors to "/" in the Manage Remote Connections
3. Setting the Upload Directory to "/httpdocs" in the Run Configuration
4. Download the files from the FTP Server.

Okay. This works if i have a "/httpdocs" folder in my FTP Space.
But most others are trapped per FTP directly in to a "/" as WebSpace. Without
any "/htdocs" or "/httpdocs" folders. Please keep that in mind when read.

You can say turn your settings in the upload Dir to "/". Thats correct. But
now another Szenario. I need a folder in the Source Files the are outside of
the Public WebRoot. I use to the previously created project.

1. Create a folder "public" in Source Files
2. Setting the WebRoot to "public" under Project Properties/Sources
3. Delete all the other Files outside my "public" folder.
4. Right Mouse Btn on the "public" folder and download.

FTP Log:
CWD /httpdocs
250 CWD command successful
CWD /httpdocs/public
550 /httpdocs/public: No such file or directory
-----------------------------------------------

Okay. There is no "public" folder in my FTP Space.

5. Going to the Run Configuration(Projects Props.) changing the Upload
Directory to nothing and try another download.

FTP Log:
CWD /
250 CWD command successful
CWD //public
550 //public: No such file or directory
----------------------------------------------

Take a look at the two trailing slashes! NetBeans wants to annoy me ;-)
I try the next step.

6. Rename my "public" folder to "httpdocs" (this is the folder on my FTP server)
7. Set the WebRoot to "httpdocs". Try another download.

FTP Log:
CWD /
250 CWD command successful
CWD //httpdocs
250 CWD command successful
PWD
257 "/httpdocs" is the current directory
SYST
215 UNIX Type: L8
PORT 192,168,2,33,208,83
200 PORT command successful
LIST /httpdocs
150 Opening BINARY mode data connection for file list
226-Transfer complete
226 Quotas off
CWD //ttpdocs/images
550 //ttpdocs/images: No such file or directory

~~~
Summary
====================
Succeeded:
dir httpdocs
file ttpdocs/about.html

~~~
Ignored:
dir ttpdocs/css Cannot change to the remote directory ttpdocs/css.
-------------------------------------------------

What the hell is "//ttpdocs" ?!? and NetBeans creates a new folder "ttpdocs" in
my source list.

In most cases, the name of the FTP server directory will be different from the
local directory. Setting the Upload Directory to "/httpdocs" will result in

FTP Log:
CWD /httpdocs
250 CWD command successful
CWD /httpdocs/httpdocs
550 /httpdocs/httpdocs: No such file or directory
CWD /httpdocs/httpdocs
550 /httpdocs/httpdocs: No such file or directory
QUIT
221 Goodbye.

Why is FTP using the local folder name of WebRoot?
(This is also the reason for the double slashes)

Solution:
FTP has only to use the settings in the Run Configuration (Upload Dir)
and the setting in Manage Remote Connections (Initial Directory).

But NetBeans add the WebRoot to the CWD that seems to be a bug for me. The WebRoot must be a local setting and not the same as the Upload Dir setting witch includes the path into the CWD command.

Can you fix this, please?

Thanks
Oliver
Tomas Mysik
2011-11-24 05:25:08 UTC
Permalink
Hi,
Post by BigGhost
Can you fix this, please?
reported and already fixed - see [1]. Use development version of NetBeans or
wait for NB 7.1 RC.

Thanks,
Tomas
[1] http://netbeans.org/bugzilla/show_bug.cgi?id=205399
BigGhost
2011-11-24 21:04:58 UTC
Permalink
Hi again,

does WebRoot working correct?

"netbeans-trunk-nightly-201111230600-ml-php-windows"

If i set WebRoot to "example". Then must "example" the root.
But this ist not the case. PHP FTP allways meens that "Source Files" is
the WebRoot an try to create "example" on the FTP Server.

Is it not possible to say:

If "Source Files" not the WebRoot then Upload Dir + "/"

Example of my Workszenario:

(GIT master repo) i have this settings

Source Files
-httpdocs <- This is my WebRoot Folder
-info <- This is my outside web folder

My Upload Directory is set to "/" (tricky point. the Dir must normaly "httpdocs")

(GIT development repo) i have this settings
Source Files
-httpdocs <- This is my WebRoot Folder
-info <- This is my outside web folder

My Upload Directory is set to "/example" (this is another development server)

But now it creates "/example/httpdocs" on my developer server.

I think it's a different behavior of creating a project from remote server
(download) and working szenario with (upload and download)

Okay. I'm the master of my machines here and i can say that my FTP development
server accept "/httpdocs" instead of "/example" as given szenario. It works
for me this way.

I'll hope you understand what i meen. The possibility to merge the developer
branch into the master. And this is not possible if i must named the directorys
in two ways.

Source File (master)
-httpdocs (WebRoot set to this results in: Upload Dir + "/httpdocs")

and

Source File (development)
-example (WebRoot set to this results in: Upload Dir + "/example")

It must be result in Upload Dir + "/". If "Source Files" not the WebRoot.

local = "Source Files" + "/httpdocs"
remote = Upload Dir + "/"

Is this circumstance solvable or not. I'm not sure ;-)

thanks for your time
Oliver
Tomas Mysik
2011-11-25 06:24:28 UTC
Permalink
Hi,
Post by BigGhost
does WebRoot working correct?
I suppose so.
Post by BigGhost
If i set WebRoot to "example". Then must "example" the root.
But this ist not the case. PHP FTP allways meens that "Source Files" is
the WebRoot an try to create "example" on the FTP Server.
Sure. The usual WebRoot means just "the folder visible by my server",
nothing more. So, the typical usage of WebRoot is to be a folder for
index.php file (as a front controller which delegates to the scripts
_outside_ of WebRoot) and all the CSS, JS and image files. In such case,
the whole Source Files directory must be uploaded to the server. For an
example, have a look at some PHP framework (Symfony, Zend, Nette etc.)
or our NetBeans PHP sample application ToDoList.

For your scenario, perhaps "example" folder should be the Source folder
and not the WebRoot? Not sure since I don't understand your scenario, sorry.

Regards,
Tomas
Paolo Scarabelli
2011-11-25 07:43:43 UTC
Permalink
Hi Oliver,

I'm not sure about the details of your case but I will try to help anyway.

The webroot is the folder containing index.php (the home page of your
project), usually is the root of the project folder which is marked as
"<Source Folder>".

If you have more than a server (i.e. one for production and one for
testing) you can create multiple configurations in "run configuration"
in project settings.

In my case I prefer to set the servers initial directory to / (click the
manage button near the "remote connection" field), then I specify the
right path in the "upload directory".

In example:

I have a project with two servers, the project is stored locally in
~/NetBeansProjects/myproject.

The specified webroot is the root of the local project folder (<Source
Folder>).

The configuration for the production server is:

initial directory: /
upload directory: /var/www/myproject

For the test server is:
initial directory: /
upload directory: /var/www/testproject


In case you have folders that must be saved outside the server webroot
you can map them (click on the "advanced" button in the project's "run
configuration" tab).

In example the server webroot is /var/www/myproject and you have a
library that must be stored in /var/lib/mylib:

The project folder will be:

~/NetBeansProjects/myproject

Your wwwroot will be:

~/NetBeansProjects/myproject/httpdocs

the library will be

~/NetBeansProjects/myproject/mylib

You can map the first to /var/www/httpdocs and the second to
/var/lib/mylib and set the project webroot to httpdocs.


I'm not actually very confident with the above configuration because I
prefer to use symlinks to map different folders (other programmers in
our team don't use netbeans and their editor don't have mapping
capabilities).

In example, with the above setup you can upload your project to
/opt/myproject

then create symlinks like:

/var/www/httpdocs -> /opt/myproject/httpdocs
/var/lib/mylib -> /opt/myproject/mylib

Still setting the project webroot to httpdocs.

Depending one your setup you can use Apache's configuration to map the
folders instead of using symlinks.


Regards,


Paolo.
BigGhost
2011-11-25 09:26:21 UTC
Permalink
Hi Thomas and Paolo,
Post by Tomas Mysik
Sure. The usual WebRoot means just "the folder visible by my server",
nothing more. So, the typical usage of WebRoot is to be a folder for
index.php file (as a front controller which delegates to the scripts
_outside_ of WebRoot) and all the CSS, JS and image files. In such case,
the whole Source Files directory must be uploaded to the server. For an
example, have a look at some PHP framework (Symfony, Zend, Nette etc.)
or our NetBeans PHP sample application ToDoList.
This is correct and clear if <Source Files> set to be the WebRoot.

But what is in this case?


Code:
Project
-<SourceFiles>
--<Private>
--<Public> <- This is the WebRoot (Visible to the Server)
---<css>
---index.php
-Include Path



In this Szenario the FTP must not create "Public" as a Folder only transfer
index.php and create "css" into the Upload Directory.

But in the moment FTP creates the Folder "Public" on the Server.

"Public" is the WebRoot. The word in WebRoot "Root" is "/" and not "Puplic".

if something is root, then it is no matter what visible name it has. it is "/".

I hope it's now clear what i meen. I will not annoy you with my explanation.
Only represent our different understandings of root. ;-)


To Paolo: Thank you for your description. I'll try this once.

regards
Oliver
Tomas Mysik
2011-11-25 10:10:56 UTC
Permalink
Hi Oliver,
Post by BigGhost
But what is in this case?
Project
-<SourceFiles>
--<Private>
--<Public> <- This is the WebRoot (Visible to the Server)
---<css>
---index.php
-Include Path
what files exactly are in the Private folder? Since you have put them
underneath _Source Files_ (= source code) than NetBeans naturally
expects source files there (PHP files etc.) and such files simply must
be uploaded. If you have there something not related to _sources_ (e.g.
documentation) then your project should be likely:

project
├── documentation - e.g. API generated by PhpDoc
├── graphic-resources - e.g. PSD files for the web graphics
├── log - log files
├── src - ftp root (ftp://myproject/)(= NetBeans' Source Files)
│ ├── app.php - script not accessible via browser
│ └── webroot - web root (http://myproject/)
│ ├── css - folder accessible via browser
│ │ └── styles.css - css accessible via browser
│ └── index.php - script accessible via browser
├── test - test files (= NetBeans' Test Files)
└── tmp - temporary files

With this project structure, NetBeans shows you in the Projects view
only Source and Test files; the other folders are still accessible via
the Files view. To the server, only project source files are uploaded,
as expected; if you want to upload e.g. "test" or "documentation" folder
as well, simply move them underneath "src" folder (you can ignore them
in the IDE via Project Properties > Ignored Folders).

Regards,
Tomas
BigGhost
2011-11-25 11:13:00 UTC
Permalink
Hello Thomas.,

we have the problem, I misunderstood the projects folder.
I try to create folders in it, ouside the "source files" with RMB
on the Project. But every folder was created unter "Source Files".

Now i understand the meaning of the Projects View. Projects View is not
the the representation of my local file system. "Source Files" is the
representation. The Files View solved the Problem to reach my outside Files.

Thank you for your explanation. Now i've the privat folder on my ignore list.
My public folder is gone and the source are directly in Source Files.

In this case the Projects folder look confused me a little bit ;-)

Now I understand your point in development.

Thanks
Oliver

Continue reading on narkive:
Search results for 'How the hell does the ftp works in netbeans ?' (Questions and Answers)
12
replies
what is the best software for web desing?
started 2013-09-03 07:18:20 UTC
programming & design
Loading...