Search code examples
codeigniterfopenfwrite

Edit file.php from controller using CodeIgniter


I need to add some content to a file from a controller in CodeIgniter, in my local enviroment I do this and works fine:

$handle = fopen(APPPATH."config/file.php", "a+");
fwrite($handle, $stuff);

fclose($handle);

However the file doesn't seem to get altered when it runs in the production environment server.

At first I though it could be permission issues but chmoding 777 the directory doesn't seem to work either


Solution

  • Dumb of me, I chmoded the folder containing the file but not the file itself.