Re: [PHP] FTP Problems
James Nunnerley wrote: Thanks for the reply Chris. How would you suggest displaying the current "home" directory for the user? I've tried / and indeed the "real" directory name on that particular server. Funnily enough, I've also just tried a generic php/ftp script tool, and it works on a third party server into the one I'm trying to connect to, but not from the server I'm working on! Is there anyway in which php needs configuring for certain connections? Even though you have this fixed.. "." means the current directory so you could: ftp_nlist($connection, "."); to display this directory and go from there. In this case: ftp_nlist($connection, "/"); Whether "/" means system level (ie so you'd see /proc, /etc and so on) or whether it takes you back to the base for that ftp account depends on the ftp server setup. Some lock you in to your /home type folder and some don't. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP Problems
James Nunnerley wrote: > Ah - whoops - just worked out why - you need to set the passive mode after > you login, not after a connect! Silly solution! sharing the fix was anything but silly - :-) > > -Original Message- > From: James Nunnerley [mailto:[EMAIL PROTECTED] > Sent: 27 June 2006 14:37 > To: 'Jochem Maas' > Cc: 'chris smith'; php-general@lists.php.net > Subject: RE: [PHP] FTP Problems > > Thanks all - it would seem that php is failing to set the passive mode to > true - I can get around it temporarily, but need to find a more permanent > option. > > Does anyone have any experience as to why setting ftp_pasv to true fails? > ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Problems
Ah - whoops - just worked out why - you need to set the passive mode after you login, not after a connect! Silly solution! -Original Message- From: James Nunnerley [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:37 To: 'Jochem Maas' Cc: 'chris smith'; php-general@lists.php.net Subject: RE: [PHP] FTP Problems Thanks all - it would seem that php is failing to set the passive mode to true - I can get around it temporarily, but need to find a more permanent option. Does anyone have any experience as to why setting ftp_pasv to true fails? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:29 To: James Nunnerley Cc: 'chris smith'; php-general@lists.php.net Subject: Re: [PHP] FTP Problems James Nunnerley wrote: > Thanks for the reply Chris. > > How would you suggest displaying the current "home" directory for the user? > I've tried / and indeed the "real" directory name on that particular server. you could try '~/' (or maybe just'~') as the dir name which equates to the 'the current users homedir' when you in a shell - no idea whether that is even allowable when going in via ftp but might be worth a shot though - given what you have been saying in your thread one would hazard to guess that the ftp server your working with is a little borked (but that a gut feeling). > > Funnily enough, I've also just tried a generic php/ftp script tool, and it > works on a third party server into the one I'm trying to connect to, but not > from the server I'm working on! > > Is there anyway in which php needs configuring for certain connections? > > -Original Message- > From: chris smith [mailto:[EMAIL PROTECTED] > Sent: 27 June 2006 14:16 > To: James Nunnerley > Cc: php-general@lists.php.net > Subject: Re: [PHP] FTP Problems > > On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: >> I'm trying to create some functionality which requires FTPing onto another >> server, using the php functions. >> >> Doing the following comes up with a successful login, but cannot display > the >> current directory; yet when I FTP directory from the server which is > serving >> the php pages, it works fine. >> >> // set up basic connection >> $conn_id = ftp_connect($ftp_server, 21); >> ftp_pasv($conn_id, true); >> >> // login with username and password >> $login_result = ftp_login($conn_id, $username, $password); >> >> // check connection >> if ((!$conn_id) || (!$login_result)) { >> >> echo "FTP connection has failed!"; >> echo "Attempted to connect to $ftp_server for user $username"; >> exit; >> >> } else { >> >> echo "Connected to $ftp_server, for user $username"; >> >> } >> >> echo(ftp_pwd($conn_id).""); # Comes back with / >> >> $buff = ftp_nlist($conn_id,""); > > ftp_nlist requires a directory name. A blank string is not a directory name. > > http://au.php.net/ftp_nlist > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Problems
Thanks all - it would seem that php is failing to set the passive mode to true - I can get around it temporarily, but need to find a more permanent option. Does anyone have any experience as to why setting ftp_pasv to true fails? -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:29 To: James Nunnerley Cc: 'chris smith'; php-general@lists.php.net Subject: Re: [PHP] FTP Problems James Nunnerley wrote: > Thanks for the reply Chris. > > How would you suggest displaying the current "home" directory for the user? > I've tried / and indeed the "real" directory name on that particular server. you could try '~/' (or maybe just'~') as the dir name which equates to the 'the current users homedir' when you in a shell - no idea whether that is even allowable when going in via ftp but might be worth a shot though - given what you have been saying in your thread one would hazard to guess that the ftp server your working with is a little borked (but that a gut feeling). > > Funnily enough, I've also just tried a generic php/ftp script tool, and it > works on a third party server into the one I'm trying to connect to, but not > from the server I'm working on! > > Is there anyway in which php needs configuring for certain connections? > > -Original Message- > From: chris smith [mailto:[EMAIL PROTECTED] > Sent: 27 June 2006 14:16 > To: James Nunnerley > Cc: php-general@lists.php.net > Subject: Re: [PHP] FTP Problems > > On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: >> I'm trying to create some functionality which requires FTPing onto another >> server, using the php functions. >> >> Doing the following comes up with a successful login, but cannot display > the >> current directory; yet when I FTP directory from the server which is > serving >> the php pages, it works fine. >> >> // set up basic connection >> $conn_id = ftp_connect($ftp_server, 21); >> ftp_pasv($conn_id, true); >> >> // login with username and password >> $login_result = ftp_login($conn_id, $username, $password); >> >> // check connection >> if ((!$conn_id) || (!$login_result)) { >> >> echo "FTP connection has failed!"; >> echo "Attempted to connect to $ftp_server for user $username"; >> exit; >> >> } else { >> >> echo "Connected to $ftp_server, for user $username"; >> >> } >> >> echo(ftp_pwd($conn_id).""); # Comes back with / >> >> $buff = ftp_nlist($conn_id,""); > > ftp_nlist requires a directory name. A blank string is not a directory name. > > http://au.php.net/ftp_nlist > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP Problems
James Nunnerley wrote: > Thanks for the reply Chris. > > How would you suggest displaying the current "home" directory for the user? > I've tried / and indeed the "real" directory name on that particular server. you could try '~/' (or maybe just'~') as the dir name which equates to the 'the current users homedir' when you in a shell - no idea whether that is even allowable when going in via ftp but might be worth a shot though - given what you have been saying in your thread one would hazard to guess that the ftp server your working with is a little borked (but that a gut feeling). > > Funnily enough, I've also just tried a generic php/ftp script tool, and it > works on a third party server into the one I'm trying to connect to, but not > from the server I'm working on! > > Is there anyway in which php needs configuring for certain connections? > > -Original Message- > From: chris smith [mailto:[EMAIL PROTECTED] > Sent: 27 June 2006 14:16 > To: James Nunnerley > Cc: php-general@lists.php.net > Subject: Re: [PHP] FTP Problems > > On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: >> I'm trying to create some functionality which requires FTPing onto another >> server, using the php functions. >> >> Doing the following comes up with a successful login, but cannot display > the >> current directory; yet when I FTP directory from the server which is > serving >> the php pages, it works fine. >> >> // set up basic connection >> $conn_id = ftp_connect($ftp_server, 21); >> ftp_pasv($conn_id, true); >> >> // login with username and password >> $login_result = ftp_login($conn_id, $username, $password); >> >> // check connection >> if ((!$conn_id) || (!$login_result)) { >> >> echo "FTP connection has failed!"; >> echo "Attempted to connect to $ftp_server for user $username"; >> exit; >> >> } else { >> >> echo "Connected to $ftp_server, for user $username"; >> >> } >> >> echo(ftp_pwd($conn_id).""); # Comes back with / >> >> $buff = ftp_nlist($conn_id,""); > > ftp_nlist requires a directory name. A blank string is not a directory name. > > http://au.php.net/ftp_nlist > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Problems
Just tried that, and still the same result - I think it's the server - going to ask the server admin now! -Original Message- From: nicolas figaro [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:19 To: PHP List Subject: Re: [PHP] FTP Problems James Nunnerley a écrit : > Nope - unfortunately, no change, still the same problems, logging in but no > ftp_nlist or indeed ftp_rawlist > > even with a pathname ? ftp_nlist($conn_id, "-a /") do you have any log on the server ? ( you can also sniff the network to watch what php sends). NF > Cheers > Nunners > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Problems
Thanks for the reply Chris. How would you suggest displaying the current "home" directory for the user? I've tried / and indeed the "real" directory name on that particular server. Funnily enough, I've also just tried a generic php/ftp script tool, and it works on a third party server into the one I'm trying to connect to, but not from the server I'm working on! Is there anyway in which php needs configuring for certain connections? -Original Message- From: chris smith [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:16 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] FTP Problems On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: > I'm trying to create some functionality which requires FTPing onto another > server, using the php functions. > > Doing the following comes up with a successful login, but cannot display the > current directory; yet when I FTP directory from the server which is serving > the php pages, it works fine. > > // set up basic connection > $conn_id = ftp_connect($ftp_server, 21); > ftp_pasv($conn_id, true); > > // login with username and password > $login_result = ftp_login($conn_id, $username, $password); > > // check connection > if ((!$conn_id) || (!$login_result)) { > > echo "FTP connection has failed!"; > echo "Attempted to connect to $ftp_server for user $username"; > exit; > > } else { > > echo "Connected to $ftp_server, for user $username"; > > } > > echo(ftp_pwd($conn_id).""); # Comes back with / > > $buff = ftp_nlist($conn_id,""); ftp_nlist requires a directory name. A blank string is not a directory name. http://au.php.net/ftp_nlist -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP Problems
James Nunnerley a écrit : Nope - unfortunately, no change, still the same problems, logging in but no ftp_nlist or indeed ftp_rawlist even with a pathname ? ftp_nlist($conn_id, "-a /") do you have any log on the server ? ( you can also sniff the network to watch what php sends). NF Cheers Nunners -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP Problems
On 6/27/06, James Nunnerley <[EMAIL PROTECTED]> wrote: I'm trying to create some functionality which requires FTPing onto another server, using the php functions. Doing the following comes up with a successful login, but cannot display the current directory; yet when I FTP directory from the server which is serving the php pages, it works fine. // set up basic connection $conn_id = ftp_connect($ftp_server, 21); ftp_pasv($conn_id, true); // login with username and password $login_result = ftp_login($conn_id, $username, $password); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $username"; exit; } else { echo "Connected to $ftp_server, for user $username"; } echo(ftp_pwd($conn_id).""); # Comes back with / $buff = ftp_nlist($conn_id,""); ftp_nlist requires a directory name. A blank string is not a directory name. http://au.php.net/ftp_nlist -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] FTP Problems
Nope - unfortunately, no change, still the same problems, logging in but no ftp_nlist or indeed ftp_rawlist Cheers Nunners -Original Message- From: nicolas figaro [mailto:[EMAIL PROTECTED] Sent: 27 June 2006 14:12 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] FTP Problems I had many troubles with ftp_nlist since I discovered the "-a" option. try this : $buff = ftp_nlist($conn_id,"-a"); N F James Nunnerley a écrit : > I'm trying to create some functionality which requires FTPing onto another > server, using the php functions. > > Doing the following comes up with a successful login, but cannot display the > current directory; yet when I FTP directory from the server which is serving > the php pages, it works fine. > > // set up basic connection > $conn_id = ftp_connect($ftp_server, 21); > ftp_pasv($conn_id, true); > > // login with username and password > $login_result = ftp_login($conn_id, $username, $password); > > // check connection > if ((!$conn_id) || (!$login_result)) { > > echo "FTP connection has failed!"; > echo "Attempted to connect to $ftp_server for user $username"; > exit; > > } else { > > echo "Connected to $ftp_server, for user $username"; > > } > > echo(ftp_pwd($conn_id).""); # Comes back with / > > $buff = ftp_nlist($conn_id,""); > > // close the FTP stream > ftp_close($conn_id); > > var_dump($buff); => comes back with bool(false) > > exit; > > Can anyone see what could be wrong? > > > Cheers > > Nunners > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FTP Problems
I had many troubles with ftp_nlist since I discovered the "-a" option. try this : $buff = ftp_nlist($conn_id,"-a"); N F James Nunnerley a écrit : I'm trying to create some functionality which requires FTPing onto another server, using the php functions. Doing the following comes up with a successful login, but cannot display the current directory; yet when I FTP directory from the server which is serving the php pages, it works fine. // set up basic connection $conn_id = ftp_connect($ftp_server, 21); ftp_pasv($conn_id, true); // login with username and password $login_result = ftp_login($conn_id, $username, $password); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $username"; exit; } else { echo "Connected to $ftp_server, for user $username"; } echo(ftp_pwd($conn_id).""); # Comes back with / $buff = ftp_nlist($conn_id,""); // close the FTP stream ftp_close($conn_id); var_dump($buff); => comes back with bool(false) exit; Can anyone see what could be wrong? Cheers Nunners -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FTP Problems
I'm trying to create some functionality which requires FTPing onto another server, using the php functions. Doing the following comes up with a successful login, but cannot display the current directory; yet when I FTP directory from the server which is serving the php pages, it works fine. // set up basic connection $conn_id = ftp_connect($ftp_server, 21); ftp_pasv($conn_id, true); // login with username and password $login_result = ftp_login($conn_id, $username, $password); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $username"; exit; } else { echo "Connected to $ftp_server, for user $username"; } echo(ftp_pwd($conn_id).""); # Comes back with / $buff = ftp_nlist($conn_id,""); // close the FTP stream ftp_close($conn_id); var_dump($buff); => comes back with bool(false) exit; Can anyone see what could be wrong? Cheers Nunners
RE: [PHP] ftp problems
[snip] What is top-post? and also, how can I show you my code is I can not send it in the email? DO I need to attach it? [/snip] Top posting is posting your reply above the message. It makes the subject read out of order. Because it is backwards. Why? Top posting is bad. Cut and paste your code into the e-mail. Only cut and paste the relevant section of code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ftp problems
[snip] Hello, I have a site that allows developers to upload current modules to the webserver. It has been requested that when this is done, I also ftp a backup copy to a remote server. Something is wrong here. The file upload code works. The back ftp code works,only if I comment out the move_uploaded_file() function. I can not get them both to work. After the move_uploaded_file() function moves the file to the webserver, the ftp_put() fails, but if I comment out the move_uploaded_file(), the ftp_put() works. Can anyone help me with this? I have posted this on other forums and working on this for a couple of weeks now. [snip] And now you have posted it here twice within 30 minutes under different headers. [snip] 1. I am uploading the module to the webserver. 2. Then in the next step want to ftp same module to backup server. [/snip] Looks like a pretty good flowchart. move_uploaded_file() is part of the upload process. Then you want to ftp the file from where you moved it to with your ftp process. move_uploaded_file() is not part of ftp [snip] I tried posting my code but it got rejected by the server for security reasons... [/snip] Cut and paste your code into the e-mail, attachments to lists aren't generally welcomed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp problems
Hello, I have a site that allows developers to upload current modules to the webserver. It has been requested that when this is done, I also ftp a backup copy to a remote server. Something is wrong here. The file upload code works. The back ftp code works,only if I comment out the move_uploaded_file() function. I can not get them both to work. After the move_uploaded_file() function moves the file to the webserver, the ftp_put() fails, but if I comment out the move_uploaded_file(), the ftp_put() works. Can anyone help me with this? I have posted this on other forums and working on this for a couple of weeks now. 1. I am uploading the module to the webserver. 2. Then in the next step want to ftp same module to backup server. I tried posting my code but it got rejected by the server for security reasons... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php