[PHP] Upload is not working ( Permission Problem), I tried a number of ways , still no success!!!!!

2004-12-01 Thread Michael Leung
Hi all,
   I am still solving my upload script problems.
Here is the error Msg:
Warning: copy(/var/www/html/upload_files/Default.bk1)
[function.copy]: failed to open stream: Permission denied in
/var/www/html/simple_upload.php on line 77

My Upload Code:
$result  =  move_uploaded_file($temp_name, $file_path);

I started to think this is not only PHP , may be Apache problem too.
Anyone has some ideas?

I have tried to set my  upload directory into 777. Even I tried to use
sudo , giving apache as root permission and running system command
copy the file from the tmp directory to upload_files.

but still no success!! I have done some research on web, no one can
suggest a solution rather than chmod 777( I did that!)



yours,
michael

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upload is not working ( Permission Problem), I tried a number of ways , still no success!!!!!

2004-12-01 Thread Gareth Williams
You could try chown user:group, where user and group are those apache 
runs in.

Is this script running on your own machine, or on a web server hosted 
somewhere?

On 1 Dec 2004, at 09:03, Michael Leung wrote:
Hi all,
   I am still solving my upload script problems.
Here is the error Msg:
Warning: copy(/var/www/html/upload_files/Default.bk1)
[function.copy]: failed to open stream: Permission denied in
/var/www/html/simple_upload.php on line 77
My Upload Code:
$result  =  move_uploaded_file($temp_name, $file_path);
I started to think this is not only PHP , may be Apache problem too.
Anyone has some ideas?
I have tried to set my  upload directory into 777. Even I tried to use
sudo , giving apache as root permission and running system command
copy the file from the tmp directory to upload_files.
but still no success!! I have done some research on web, no one can
suggest a solution rather than chmod 777( I did that!)

yours,
michael
--
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] Upload is not working ( Permission Problem), I tried a number of ways , still no success!!!!!

2004-12-01 Thread Scott Fletcher
The directory folder where you upload the file(s) and folder(s) inito must
have the ownership of Apache and the permission of 755.  Then you'll have no
trouble uploading file(s)/folder(s) into it since Apache would have the
permission to create the file(s)/folder(s) where none exist or update them
only if the file(s)/folder(s) was created by Apache in the past.  If those
file(s)/folder(s) weren't created by Apache but by you or someone then it
wouldn't work because the ownership would be different, you'll need to
change the ownership and permission to what Apache can use.

This is from what I had noticed and had no trouble with them since then.
When I move the files from 1 webserver to another, I alway check the
ownership and correct it if it is wrong the first time.

Scott

Gareth Williams [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You could try chown user:group, where user and group are those apache
 runs in.

 Is this script running on your own machine, or on a web server hosted
 somewhere?

 On 1 Dec 2004, at 09:03, Michael Leung wrote:

  Hi all,
 I am still solving my upload script problems.
  Here is the error Msg:
  Warning: copy(/var/www/html/upload_files/Default.bk1)
  [function.copy]: failed to open stream: Permission denied in
  /var/www/html/simple_upload.php on line 77
 
  My Upload Code:
  $result  =  move_uploaded_file($temp_name, $file_path);
 
  I started to think this is not only PHP , may be Apache problem too.
  Anyone has some ideas?
 
  I have tried to set my  upload directory into 777. Even I tried to use
  sudo , giving apache as root permission and running system command
  copy the file from the tmp directory to upload_files.
 
  but still no success!! I have done some research on web, no one can
  suggest a solution rather than chmod 777( I did that!)
 
 
 
  yours,
  michael
 
  -- 
  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] Upload is not working ( Permission Problem), I tried a number of ways , still no success!!!!!

2004-12-01 Thread Richard Lynch
 Hi all,
I am still solving my upload script problems.
 Here is the error Msg:
 Warning: copy(/var/www/html/upload_files/Default.bk1)
 [function.copy]: failed to open stream: Permission denied in
 /var/www/html/simple_upload.php on line 77

 My Upload Code:
 $result  =  move_uploaded_file($temp_name, $file_path);

 I started to think this is not only PHP , may be Apache problem too.
 Anyone has some ideas?

 I have tried to set my  upload directory into 777. Even I tried to use
 sudo , giving apache as root permission and running system command
 copy the file from the tmp directory to upload_files.

 but still no success!! I have done some research on web, no one can
 suggest a solution rather than chmod 777( I did that!)

Does the PHP user (aka the Apache user) have permission to *READ* from and
*WRITE* to the TMP directory?

You may be attacking the wrong side of the equation.

I believe PHP will complain the same way whether it can't read/write /tmp,
or it can't read/write to your destination directory.

PS

For God's sake change your permissions back to something reasonable, and
stop running Apache as root, *NOW*.

Actually, from a more practical stand-point, *change* your upload
destination to some place *outside* the web tree, so that when PHP dumps
stuff in there, possibly some stuff you don't *want* in there, possibly
because some user is playing games with your site, then you can write some
code to examine the content before doing anything with it -- Specifically
*before* it ends up living on your public web-server.

Example:  Bad guy decides your server would be a nice place to upload not
a worksheet, but his latest cracked video game or highly-popular software
package or, ahem, graphic images.  Then *your* server becomes a free
source of illegal content, or content you are not in the business of
hosting.  That's bad.  Real bad.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upload is not working ( Permission Problem), I tried a number of ways , still no success!!!!!

2004-12-01 Thread Michael Leung
Hi Scott,
  Thank you for your help, but I have tried to user chown -r
apache:apache upload_files.
this is not working. 

yours,
Michael

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php