Current location: Hot Scripts Forums » Programming Languages » PHP » Chmod Function Help


Chmod Function Help

Reply
  #1 (permalink)  
Old 02-05-04, 04:29 AM
tsb tsb is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Chmod Function Help

When i use the chmod funtion to try and chmod a 0644 file to 0666, using chmod("file.php", 0666);, it comes up with the error:

Quote:
Warning: chmod() [function.chmod]: Operation not permitted in /users/web/blah/web/chmod.php on line 2
Any idea why?
Reply With Quote
  #2 (permalink)  
Old 02-05-04, 06:49 AM
tsb tsb is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Anyone?
Reply With Quote
  #3 (permalink)  
Old 02-05-04, 08:29 AM
cliftonarms cliftonarms is offline
Newbie Coder
 
Join Date: Feb 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Check that you own the directory that you are trying to change permissions for.
Reply With Quote
  #4 (permalink)  
Old 02-05-04, 09:54 AM
tsb tsb is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
what do you mean by 'own'?
Reply With Quote
  #5 (permalink)  
Old 02-05-04, 09:58 AM
jewellgr jewellgr is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Michigan USA
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
The chmod() function operates under UNIX-systems but does not work for windows-based systems.
__________________
ArecaWeb Team
Gregg Kenneth Jewell
Reply With Quote
  #6 (permalink)  
Old 02-05-04, 10:14 AM
tsb tsb is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
is there a ways to chmod a file using php with a windows-based system then?
Reply With Quote
  #7 (permalink)  
Old 02-06-04, 12:24 AM
Skeleton Man Skeleton Man is offline
Community Liaison
 
Join Date: Jun 2003
Location: Australia
Posts: 406
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by tsb
is there a ways to chmod a file using php with a windows-based system then?
There is no such thing as chmod under windows..
Reply With Quote
  #8 (permalink)  
Old 02-06-04, 04:49 AM
tsb tsb is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
The server's linux, can someone just explain why it isn't working, or if it doesn't work on a linux server, then what will? I can chmod folders using php fine, just not files.
Reply With Quote
  #9 (permalink)  
Old 02-06-04, 05:34 AM
Skeleton Man Skeleton Man is offline
Community Liaison
 
Join Date: Jun 2003
Location: Australia
Posts: 406
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by tsb
The server's linux, can someone just explain why it isn't working, or if it doesn't work on a linux server, then what will? I can chmod folders using php fine, just not files.
My guess.. PHP runs as user nobody, and the files you're trying to chmod are owned by your username.. if 'nobody' tries to chmod files owned by 'jsmith' then they'll get an error coz it's not allowed..

Try chmodding the existing files from your FTP client, then try creating some small text files with PHP and chmodding them with the script.. If both these work then it's almost certainly the above problem..
Reply With Quote
  #10 (permalink)  
Old 02-06-04, 10:44 PM
tltran tltran is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Montreal
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Skeleton Man
My guess.. PHP runs as user nobody, and the files you're trying to chmod are owned by your username.. if 'nobody' tries to chmod files owned by 'jsmith' then they'll get an error coz it's not allowed..

Try chmodding the existing files from your FTP client, then try creating some small text files with PHP and chmodding them with the script.. If both these work then it's almost certainly the above problem..

Very good explanation,
__________________
Thanh Liem Tran
When You have to run, you have to run
http://www.irunsoft.com
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
accessing existing ISP email with a PHP webmail script. nlancaster PHP 1 01-07-04 03:28 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM
Help trim code down TheLaughingBandit JavaScript 0 09-02-03 09:50 AM
File Management, sorry i keep changing, this is the last one! :) Arctic ASP 28 08-29-03 12:04 AM


All times are GMT -5. The time now is 08:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.