Problems with chmod()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
EDUARD59
Forum Newbie
Posts: 3
Joined: Wed Oct 14, 2009 9:22 am

Problems with chmod()

Post by EDUARD59 »

I am trying to change the file permissions of the file "contador.txt" with the following program:

<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors',true);
chmod("contador.txt",0777);
?>

The file contador.txt is in the same directory of the script.
But I can't change the file permissions ant the following message appears:

Warning: chmod():Operation not permitted in /usr/www/htdocs/eduardo/cambia.php on line 5

What can I do? Please help
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Problems with chmod()

Post by Jonah Bron »

A quick search found that that function could be disabled in your php.ini. The other possibility is that you don't have permission to chmod that file.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Problems with chmod()

Post by VladSun »

Warning: chmod():Operation not permitted in /usr/www/htdocs/eduardo/cambia.php on line 5
means that you are not the owner of the file you are trying to chmod.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply