Re: [PHP] ftp root dir?
On Tue, May 22, 2007 10:19 am, Al wrote: I know that; but, I writing a script, that can be used on different servers, which creates a directory and I want to make certain it is created on the DOC ROOT. I don't want the user to have to test the ftp connection with a ftp utility program first. What you want and how the world actually exists are not matching up... We cannot fix that... :-v -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp root dir?
On Tue, May 22, 2007 9:50 am, Al wrote: Can I assume that all ftp_connect()s will make the current dir the DOC_ROOT? Probably not. If I FTP connect to *my* webhosted servers, I'm put into a directory which contains 'www' and 'php' and 'private' which are set up by the host for 'DOCUMENT_ROOT' 'include_path' and 'openbase_dir' respectively, as well as any other directories/files I chose to add there. It all depends how FTP and www server are configured, and they are not tied at the hip by any means. If not, how can I insure the ftp root dir is the same as DOC_ROOT? You'll have to ASK the user to config their own account to map things up, I guess... You can't use the absolute path with ftp. Again, depends on FPT server and setup -- Some FTP setups accept an absolute path and allow the FTP user to start at the '/' box root directory, but not all the time. chdir() doesn't change the ftp current dir. No, it changes the directory on your PHP server box. if you ftp_chdir() and it's already on the root, it posts an error. You should be able to catch that and get rid of it. ftp_pwd() simply returns /, which simply says it's on its root, where ever that is. Yes. That is where it is. Unless it's been configured to not only have its own root, but also to change the user to a non-root directory upon login, which is also possible setup, especially when the user is allowed to run rampant all over hte box, and the FTP server relies on user/access permissions on the box to control access. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp root dir?
Can I assume that all ftp_connect()s will make the current dir the DOC_ROOT? If not, how can I insure the ftp root dir is the same as DOC_ROOT? You can't use the absolute path with ftp. chdir() doesn't change the ftp current dir. if you ftp_chdir() and it's already on the root, it posts an error. ftp_pwd() simply returns /, which simply says it's on its root, where ever that is. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp root dir?
I know that; but, I writing a script, that can be used on different servers, which creates a directory and I want to make certain it is created on the DOC ROOT. I don't want the user to have to test the ftp connection with a ftp utility program first. Jim Moseby wrote: r? Can I assume that all ftp_connect()s will make the current dir the DOC_ROOT? If not, how can I insure the ftp root dir is the same as DOC_ROOT? You can't use the absolute path with ftp. chdir() doesn't change the ftp current dir. if you ftp_chdir() and it's already on the root, it posts an error. ftp_pwd() simply returns /, which simply says it's on its root, where ever that is. The ftp_* functions behave just as any ftp client behaves, AFAIK. If you log into the FTP server via your favorite command-line FTP client, you are seeing the exact same behaviour as the ftp_* functions will see. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ftp root dir?
r? Can I assume that all ftp_connect()s will make the current dir the DOC_ROOT? If not, how can I insure the ftp root dir is the same as DOC_ROOT? You can't use the absolute path with ftp. chdir() doesn't change the ftp current dir. if you ftp_chdir() and it's already on the root, it posts an error. ftp_pwd() simply returns /, which simply says it's on its root, where ever that is. The ftp_* functions behave just as any ftp client behaves, AFAIK. If you log into the FTP server via your favorite command-line FTP client, you are seeing the exact same behaviour as the ftp_* functions will see. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ftp root dir?
On Tue, 2007-05-22 at 11:19 -0400, Al wrote: I know that; but, I writing a script, that can be used on different servers, which creates a directory and I want to make certain it is created on the DOC ROOT. I don't want the user to have to test the ftp connection with a ftp utility program first. You can only do that if you have control over the ftp server settings such that the FTP directory overlaps your DOC_ROOT at some point. And even then you need to know exactly how it overlaps since FTP doesn't expose it's real location to FTP clients (at least not that I know of). Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] ftp root dir?
Hi Al, Tuesday, May 22, 2007, 4:19:22 PM, you wrote: I know that; but, I writing a script, that can be used on different servers, which creates a directory and I want to make certain it is created on the DOC ROOT. I don't want the user to have to test the ftp connection with a ftp utility program first. I'd have to say 'impossible'. This value isn't stored in any one variable or even in a system value you can rely on. For example you could probably extract the FTP home directory of a given user on a Unix system with a bit less pain than on a Windows server, but within IIS which managers FTP on Windows, you'd have to query the IIS service itself (via its COM object) to find out the home dir of a user, which will (and can) vary per user, assuming they even have one set. That doesn't even begin to cover all the various other FTP Servers out there, such as ServU, GlobalScape, TitanFTP, FileZilla Server, SurgeFTP, etc, etc. Each one holds its users root directories in different ways, and you'd need to know them *all*. Some hold them in ini files, some in xml, some in the registry, some in custom binary formats. You get the idea. Like I said, I think you're heading into 'impossible' territory here. Find another way to achieve the same end result. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk Never trust a computer you can't throw out of a window -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php