ftp_get() on new domain won't download files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • unicorn
    New Member
    • Sep 2006
    • 23

    ftp_get() on new domain won't download files

    Hi guys,

    I have moved my site from one domain to another. it worked perfectly on old domain, ftp_put(), ftp_delete() - i.e. FTP upload and remove scripts work fine, but... i have problem using ftp_get() wicth shows me error, and says :

    Warning: ftp_get() [function.ftp-get]: Error opening 4.gif in /home/mydomain/public_html/down_att.php on line 43

    Couldn't download file '4.gif' .


    i have checked connection, path. well if i change path (ftp directory) to this file it gives me error that it cannot find this file on this path, so path is correct.

    i have checked directories, filename, permissions. i have no clue why it doesn work, i appriciate your advice, thanks.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, unicorn.

    Originally posted by unicorn
    i have checked connection, path. well if i change path (ftp directory) to this file it gives me error that it cannot find this file on this path, so path is correct.
    I'm confused. If you tried the path, and it said that it couldn't find the file, doesn't that mean that the path is *not* correct?

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Changed thread title to better describe the problem.

      Comment

      • unicorn
        New Member
        • Sep 2006
        • 23

        #4
        read more carefully, i said 'when' i changed path from 'correct' path to 'incorrect' path, it showed me error that file is not found, that means that when path was correct, it could see file, but couldn't read it. thanks...

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Ok, so what you're saying is if you were to drop into your command line, fire up ftp and attempt to GET the image at the path that you are currently using, ftp will download the file without a hitch.

          But when you try more or less the same thing in PHP, you get the error.

          Is this correct?

          Comment

          • unicorn
            New Member
            • Sep 2006
            • 23

            #6
            Originally posted by pbmods
            Ok, so what you're saying is if you were to drop into your command line, fire up ftp and attempt to GET the image at the path that you are currently using, ftp will download the file without a hitch.

            But when you try more or less the same thing in PHP, you get the error.

            Is this correct?
            yes exactly, if i access file (image or whatever) through command line or ftp manager, there is no problem, i can write, delete, do whatever i want to this files in that directory but cannot download. i wrote hosters, but thay said that maybe my ip addres is blocked :) i've never heard anything more silly... if it is blocked how can i WRITE or DELETE files through PHP commands... oh, and this files are not in common directlry (public_html), because i want to prevent direct access...

            first i thought that maybe there are some problems with permissions on /tmp directory (probably place where it copies file till it sends file) but i've sett all permissions to 0777...

            thank you for your soon reply :)

            Comment

            • pbmods
              Recognized Expert Expert
              • Apr 2007
              • 5821

              #7
              Oh. Then I have no idea.

              Haha Just kidding!

              Ok. So there's some kind of error when you attempt to ftp_get() the file.

              Couple of ideas rattling around in my head right now:
              • Is the problem specifically related to ftp_get()? In other words, can you include() or file_get_conten ts()?
              • Can you read a file in the same directory? What if you moved the file to a different directory?
              • Are there any symbolic links in the path (ok, so now I'm grasping at straws)?


              Also, is ftp_get() giving you the 'Error opening 4.gif' warning, or is that a custom trigger_error() ? What does your error_log say?

              Comment

              • unicorn
                New Member
                • Sep 2006
                • 23

                #8
                Originally posted by pbmods
                Oh. Then I have no idea.

                Haha Just kidding!

                Ok. So there's some kind of error when you attempt to ftp_get() the file.

                Couple of ideas rattling around in my head right now:
                • Is the problem specifically related to ftp_get()? In other words, can you include() or file_get_conten ts()?
                • Can you read a file in the same directory? What if you moved the file to a different directory?
                • Are there any symbolic links in the path (ok, so now I'm grasping at straws)?


                Also, is ftp_get() giving you the 'Error opening 4.gif' warning, or is that a custom trigger_error() ? What does your error_log say?
                ok, here we go:

                i have tryed to GET other files in other directories (including php script folder and root folder), it gives same error. in error log it says:

                ftp_get() [<a href='function. ftp-get'>function.f tp-get</a>]: Error opening 4.gif in /home/ mydomain/public_html/down_att.php on line 43

                in download script i'm using include() to include script with functions and to include configuration file. and i doesnt give me any error and functions work (i have checked in output stream).

                and there are not symbolic characters in path, (i have tryed root folder...) only alphabet & numeric.

                thank you again.

                Comment

                • pbmods
                  Recognized Expert Expert
                  • Apr 2007
                  • 5821

                  #9
                  Heya, Unicorn.

                  I've posted a note on our PHP Expert panel. Hopefully we can get some more brains pondering over this problem.

                  Comment

                  • unicorn
                    New Member
                    • Sep 2006
                    • 23

                    #10
                    Originally posted by pbmods
                    Heya, Unicorn.

                    I've posted a note on our PHP Expert panel. Hopefully we can get some more brains pondering over this problem.
                    thanks a lot. i hope i will receive normal answer from hoster too :)

                    Comment

                    • Banfa
                      Recognized Expert Expert
                      • Feb 2006
                      • 9067

                      #11
                      When it says failed to open 4.gif is that the remote or local file?

                      You say you have checked directory permissions, what are they set to.

                      How about posting down_att.php for us to see or al leats the code around line 43.

                      Comment

                      • kovik
                        Recognized Expert Top Contributor
                        • Jun 2007
                        • 1044

                        #12
                        Yes, show some code and let us know what the permissions are on the file as well (not just the directory, the file itself).

                        Comment

                        • Motoma
                          Recognized Expert Specialist
                          • Jan 2007
                          • 3236

                          #13
                          This is a message so I can subscribe to the thread. We will need to see the code you are using in order to get some insight into the way your script is working.

                          Comment

                          • r4ccoon
                            New Member
                            • Jul 2007
                            • 3

                            #14
                            maybe you want to use ftp_chdir function..to change directory to your file,
                            and then use ftp_get to get your file, remember that use filename without path, like "4.gif"

                            Comment

                            Working...