Results 1 to 6 of 6
Thread: CHMOD through PHP
-
09-13-2002, 06:35 AM #1Web Hosting Evangelist
- Join Date
- May 2002
- Location
- Durham - UK
- Posts
- 450
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
-
09-13-2002, 06:45 AM #2Junior Guru Wannabe
- Join Date
- Dec 2001
- Location
- New Hampshire
- Posts
- 93
WYSIWYG
-
09-13-2002, 06:47 AM #3Web Hosting Evangelist
- Join Date
- May 2002
- Location
- Durham - UK
- Posts
- 450
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
-
09-13-2002, 06:51 AM #4Web Hosting Master
- Join Date
- May 2002
- Location
- UK
- Posts
- 2,997
chmod is also a protected function under safe_mode although you are not restricted from executing it.
-
09-13-2002, 06:55 AM #5Web Hosting Evangelist
- Join Date
- May 2002
- Location
- Durham - UK
- Posts
- 450
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 3Barry
UK Based Freelance PHP Developer
PHP/SQL/Ajax/HTML5 - Contact for Quote
-
09-13-2002, 12:50 PM #6Junior 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/