hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : CHMOD through PHP
Reply

Forum Jump

CHMOD through PHP

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-13-2002, 06:35 AM
barrywien barrywien is offline
Aspiring Evangelist
 
Join Date: May 2002
Location: Durham - UK
Posts: 445
Question

CHMOD through PHP


Hi
I have designed a few PHP scripts in the past but I would like to create a sort of installer file that will setup all the file permissions needed to run a program.

Does anyone know if it is actually possible to chmod a file or folder through a PHP file and if so how?

Any help would be really good.

__________________
Barry
UK Based Freelance PHP Developer
PHP/SQL/Ajax/HTML5 - Contact for Quote



Sponsored Links
  #2  
Old 09-13-2002, 06:45 AM
prosayist prosayist is offline
Junior Guru Wannabe
 
Join Date: Dec 2001
Location: New Hampshire
Posts: 93

__________________
WYSIWYG

  #3  
Old 09-13-2002, 06:47 AM
barrywien barrywien is offline
Aspiring Evangelist
 
Join Date: May 2002
Location: Durham - UK
Posts: 445
Hi
I tried the script in the manual, but it didn't seem to work as the file's permission didnt seem to change.

__________________
Barry
UK Based Freelance PHP Developer
PHP/SQL/Ajax/HTML5 - Contact for Quote

Sponsored Links
  #4  
Old 09-13-2002, 06:51 AM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994
chmod is also a protected function under safe_mode although you are not restricted from executing it.

  #5  
Old 09-13-2002, 06:55 AM
barrywien barrywien is offline
Aspiring Evangelist
 
Join Date: May 2002
Location: Durham - UK
Posts: 445
Upon viewing the following code via web browser i get the errors posted below:

<?
chmod ("/home/dedi/public_html/demo/sessions", 0777);
chmod ("/home/dedi/public_html/demo/admin/admin_1.php", 0666);
?>


Shows:

Warning: chmod failed: Operation not permitted in /home/dedi/public_html/demo/install.php on line 2

Warning: chmod failed: Operation not permitted in /home/dedi/public_html/demo/install.php on line 3

__________________
Barry
UK Based Freelance PHP Developer
PHP/SQL/Ajax/HTML5 - Contact for Quote

  #6  
Old 09-13-2002, 12:50 PM
ranchoweb ranchoweb is offline
Junior Guru Wannabe
 
Join Date: Mar 2002
Location: San Jose, CA
Posts: 34
the web server most likely runs as "nobody" or some other less-priveleged user. So the files/directories you are trying to chmod must be owned by the user "nobody" which will most likely never be the case unless you set them explicitly, which would defeat the whole purpose of doing it in your script anyway!

__________________
ranchoweb.com
reliable linux hosting with all the trimmings
http://www.ranchoweb.com/webhost/

Reply

Related posts from TheWhir.com
Title Type Date Posted


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?