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?
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.