Our oldest server is a VPS through Interland and has a number of websites (also old, go figure). Just recently, early to mid December, all the PHP upload scripts ceased to function. PHP version 4.0.6

The file takes an appropriate amount of time to upload, and a filename appears on the server but there is no content - 0 bytes.

There's nothing critical on the server anymore, but one site does rely on PHPadnews, and HTMLarea with filemanager / image uploader. All three no longer work, just giving 0 byte filesize.

I uploaded a backup of the php ini file just in case, but had no effect. There is plenty of disk space left on server, also reuploaded the scripts in question in case they had been corrupted. No change.

Any ideas on what could be causing this and how I could go about testing / fixing?

    Any ideas whatsoever? I'm completely stumped

    The PHP file / image upload applications of various different programs have all worked flawlessly for the last 1+ years, and then suddenly the server can't handle file uploads except through FTP.

    Is it perhaps a problem with the temporary directory the server uses when copying files over? If I can upload text data from a form, store it in an array, and print it out, you'd think the file upload would work too.

    We're about to just dump the hosting company :/

      are you sure your host didnt upgrade to a new version of php?

      or maybe they turned register globals off?

      use
      <?php phpinfo(); ?>
      to see all the config settings, and look for something that might be related to your problem.

      and finally, have you asked your host about this? that would have been one of the first things i did if i couldnt find the problem in a few minutes....

      on a side note- if your host wont run a version of php any newer than 4.06.....i would look elsewhere regardless.

        Yeah, first thing I did was check phpinfo.

        The server is not a very good server, I'll be the first to agree, but we didn't want to spend the time investment in migrating all those old websites over to our newer servers (for which we have WHM, cpanel, etc) until some later date this year.

        The php.ini configuration is still the same as it ever was, no upgrades apparently done either.

        We did talk to the hosting company, but we were told they offer no support for PHP. As long as they can get their standard "PHP test" script to work, that's all they offer.

        PHP works fine on the server for pretty much everything except file uploads now, and several different scripts that utilize file upload broke simultaneously, so it's gotta be some configuration issue.

        Just wish there was a way I could test and debug this with some methodology.. at the moment I don't know which way to turn.

          what output do you get from this?

          
          <form method="post" action="upl.php" enctype="multipart/form-data">
          <input type="file" name="the_file"><br>
          <input type="submit">
          </form>
          
          <pre>
          <?php
          
          print_r($HTTP_POST_FILES);
          
          ?>
          
          

          you might want to post the results from phpinfo();

          just edit out any sensitive info

          but if they did not change the version of php, and you have uploaded a copy of a known working php.ini, im thinking its not a php issue.

          maybe php is not getting the file from apache properly?
          maybe apache has been set not to allow file uploads?

            Sorry, I forgot to check these forums yesterday 🙂

            I uploaded your script, and this is the result I get:

            Array
            (
                [the_file] => Array
                    (
                        [name] => bigtoe.gif
                        [type] => image/gif
                        [tmp_name] => /var/tmp//php1IPoPk
                        [size] => 0
                    )
            
            )
            

            That doesn't look right with the double slashes... also, file uploads are set to 1, all the file handling values are set correctly, the upload_tmp_dir is set to use the system default.

              yeah the double slashes are prob a reult of a missing part of the filepath.

              maybe php checks the filesize based on that path, finds its not existant so returns a value of 0

              im sorry i dont know what could cause that.

              try setting a different upload tmp dir and see what happens. make a directory in your doc root and set it to that.

              if it still doesnt work, then leave that new setting and upload a file, and have some php code check if the file exists in your new tmp dir. or maybe even scan the dir for all files.

                Yeah, I changed the temporary directory to the one that SHOULD be the system default, and I also tried doing it in another directory. Made sure it was sticking after apache restart with phpinfo.

                Sadly the file uploads still did not work... returns at 0 bytes, no file appears in the directories I tried.

                Might be time to just bite the bullet and drop the server 🙁

                  Write a Reply...