Attention: PROnetworks has upgraded our forum from phpbb2 to phpbb3!!

Please head over to our new converted forum at: http://www.pronetworks.org/forums/

This old forum will remain 'read-only' until approximately February 2009. We look forward to seeing you at the new forum!
Author Message
Dalsim
PostPosted: Fri May 14, 2004 1:04 am Reply with quote

PROfessional Member
 
 


Joined: 15 Jun 2003
Posts: 5399
Location: Queensland, Australia
Ok Weaver, I got your upload script working to a certain extent. I can now upload via it but the problem being is that I can not access anything that I have uploaded via it, I keep getting a 401 error. I tryed another script thinking that iti could have been a problem with the authentication on that subdir but the other script worked.

I would like to use yours' due to the features that you have in it.

Any idea what the problem is?
 
Back to top
Weaver
PostPosted: Fri May 14, 2004 2:03 am Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
dalsim wrote:
Ok Weaver, I got your upload script working to a certain extent. I can now upload via it but the problem being is that I can not access anything that I have uploaded via it, I keep getting a 401 error. I tryed another script thinking that iti could have been a problem with the authentication on that subdir but the other script worked.

I would like to use yours' due to the features that you have in it.

Any idea what the problem is?


For those of you not familiar with what he is referring to, you can access the upload script here .

Jeff, what platform are you running the script on? I haven't tested it using Apache on Windows. I have tested it using recent versions of Apache and PHP on Linux. Windows based PHP has been known to cause issues with many scripts.

So you have the $UPLOAD_DIR set to a place inside your web docuemnt tree? After the files are uploaded, they are placed in a directory that is accessible on the web, correct? If so, I wouldn't recommend it. But if you really need to, I suppose.

Like I mentioned above, I am going to need to know what OS, what webserver, what version of PHP, etc. Do you have safe_mode enabled, how about register_globals ? Also post the specific error that you are receiving. You may want to try using a different browser and see if that solves your problem, just a thought.

If all else fails, I can take a look at it on your server.

-Weaver
 
Back to top
Dalsim
PostPosted: Fri May 14, 2004 4:57 am Reply with quote

PROfessional Member
 
 


Joined: 15 Jun 2003
Posts: 5399
Location: Queensland, Australia
I am running version 1.3.29 of apache. Here is the info for the version of php 4.3.4 I am running http://www.self-solutions.net/phpinfo.php

I am using RedHat Enterprise 3 Kernel version 2.6.3-sxeon-3w

This is the setup for the script http://www.self-solutions.net/upload.txt

I appreciate you helping me with this.
 
Back to top
Weaver
PostPosted: Fri May 14, 2004 11:48 am Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
Alright Jeff, I have a couple of ideas.

First off, why are you running PHP in CGI mode and not as a module? That might have something to do with it, might not. I have a few other ideas below.

Your post_max_size is set to 55 MiB, that's fine (it's actually quite large).

Your upload_max_filesize is set to 2 MiB. As such, the largest file you will be able to upload is 2 MiB even though post_max_size is 55 MiB.

Your max_input_time is set to -1, this means that it pulls its value from max_execution_time (and not unlimited as many people think).

Your max_execution time is set to 30 [seconds].

With your current configuration the largest file you can upload is 2 MiB in size and you have to do it in 30 seconds or less (including any execution time).

If you are trying to upload a file larger than 2 MiB, you will have problems. If it takes you longer than 30 seconds to upload, you will have problems. These are all options that you can change in your php.ini file.

In the next version of the script ( 0.3 ) I am going to include some functionality to check to make sure these values are set to something sane.

Essentially, the values in your php.ini that need attention are:

post_max_size
file_uploads
upload_max_filesize
memory_limit (if enabled on compilation --enable-memory-limit)
max_execution_time
max_input_time

Below are two very good references about file uploads and php.ini settings:

http://www.php.net/manual/en/features.file-upload.common-pitfalls.php
http://www.radinks.com/upload/config.php

Hope that helps. If none of it does, we may want to look into the fact that you are running PHP in CGI mode, although I don't see how that would have an impact.

I have updated my version of the README file to reflect most of the information contained in this post. This new version of the README will be available with the next version which I hope to have out in a week or so.

Let me know if you still have problems.

-Weaver
 
Back to top
Dalsim
PostPosted: Fri May 14, 2004 12:28 pm Reply with quote

PROfessional Member
 
 


Joined: 15 Jun 2003
Posts: 5399
Location: Queensland, Australia
Did some playing with the settings and still having the problems, so I set them back to how they were.

As for PHP running in CGI mode..... I have no idea on that one. I'll have to talk to Aaron (my techy) on that one. He is the one that set my server up and maintains it.
 
Back to top
Weaver
PostPosted: Fri May 14, 2004 12:48 pm Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
Alright then, it sounds to me like it may be an Apache issue. I think I may have interpreted your problem wrong. The files are actually getting uploaded succesfully correct? You just receive the error when trying to access them right away correct?

A 401 error deals with being unauthorised because the browser has not sent the correct (or any) authentication information when it is required.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Your Apache config may NOT be setup incorrectly, it may just be setup with a very secure or harsh '/' level ruleset/options. You should run through your httpd.conf file to make sure that authentication (basic or digest style) authentication is required in the specific directory or in some weird '/' level directive.

Also check to make sure that you don't have an .htaccess file that requires authentication in your home directory or in your public_html/htdocs directory, or any directory that is a parent to $UPLOAD_DIR . .htaccess files are inherited by child directories (one of the reasons they slow down web servers).

All in all, now that I have a better understanding of the situation, it sounds to me like an Apache configuration or .htaccess issue. Consult your techie if you aren't familiar.

-Weaver
 
Back to top
Dalsim
PostPosted: Fri May 14, 2004 12:53 pm Reply with quote

PROfessional Member
 
 


Joined: 15 Jun 2003
Posts: 5399
Location: Queensland, Australia
Yes the files are being uploaded successfully I just can not access them afterwards if I upload with your script. The thing is I don't have the same problem when I use other upload scripts.
 
Back to top
Weaver
PostPosted: Fri May 14, 2004 1:10 pm Reply with quote

PROfessional Member
 
 


Joined: 18 Jun 2002
Posts: 2587
Location: /home/weaver/
The only advice that I can offer is that you troubleshoot. I have tested the script on multiple *nix systems without hitch. Consult your Apache logs, access logs, error logs, etc. Check permissions. Compare the permission set and ownership of the files to the UID and GID that Apache is running as.

I don't know what more I can tell you, since you have access to the machine you are going to have put those troubleshooting skills to the test. If the files are getting uploaded successfully, then the script has done its job. When you access the files afterwards, the script isn't executing.

It sounds to me like either a configuration (httpd.conf/.htaccess) issue or a permissions issue. Like I mentioned above, be sure that permissions are are all correct. The script uses move_uploaded_file() which plays games with the permissions/etc.

Use your best judgement.

-Weaver
 
Back to top
Dalsim
PostPosted: Fri May 14, 2004 9:33 pm Reply with quote

PROfessional Member
 
 


Joined: 15 Jun 2003
Posts: 5399
Location: Queensland, Australia
Use my best judgement. Yea totally new to the *nix environment. I'll talk to my techie on this.

Thanks for the help.
 
Back to top
Back to top
Index >> Webmaster Domain & Code Room >> Weavers' PHP Upload Script.

Page 1 of 1

 


Tired of the Ads? Registered users have 80% less adverts.