Warning: chmod() [function.chmod]: Operation not permitted ?

Hi,
I have a PHP script that changes permissions on a file, writes to it and then changes permissions back.

But I am getting the following error?

Is there something I need to change in WHM or php.ini file to allow chmod?

Thanks,

Andrew

chmod($file, 0777); //change permissions to allow write
chmod($file, 0644); //change permissions of back after update




Warning: chmod() [function.chmod]: Operation not permitted in /home/mywebsite/public_html/admin/website_settings.php on line 12

Warning: chmod() [function.chmod]: Operation not permitted in /home/mywebsite/public_html/admin/website_settings.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/admin/website_settings.php:12) in /home/mywebsite/public_html/admin/website_settings.php on line 388
sabecsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
Apache normally runs under a limited user that does not have permission to do those things.  You have to enable or implement 'suexec' to get PHP functions to run under your own user permissions.  http://httpd.apache.org/docs/2.2/suexec.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.