Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Create a file in the plugin folder

edited January 2011 in Vanilla 2.0 - 2.8
so, just like the title says, I am developing a plugin that requires its default.php to create a file upon install, right next to the default.php file in the plugin folder...

I have tried several ways, none succeeded:
file_put_contents('test.php', 'bla'); -> creates the file in the root folder
file_put_contents('/test.php', 'bla'); -> does nothing
file_put_contents('./test.php', 'bla'); ->does nothing
file_put_contents(Gdn_Url::WebRoot(true).'/test.php', 'bla'); -> nothing, not even in root
file_put_contents(PATH_PLUGINS.DS.'tInfoBar'.DS.'test.php', 'bla'); -> nothing

Did any1 else encountered this problem and knows a solution to it?


  • Options
    This is a generic PHP issue. To create a file, the script creating the file needs permissions to do. My guess is that it doesn't. Where you go from there depends on how your system is set up, i.e. it depends on users, owners of files and directories and permissions.

    Sorry if that is vague, but that is the bottom line. Since you are writing php scripts to your public web area, I think you need to learn a bit more about what that means for security.
  • Options
    TimTim Operations Vanilla Staff
    You should write to vanilla's cache/ or uploads/ folders, as our install requires that vanilla has write access to those areas. Writing to other areas of the codebase is not guaranteed to be possible, nor should it be.

    Vanilla Forums COO [GitHub, Twitter,]

Sign In or Register to comment.