We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2444
    • 4 Posts
    Just thought I would share this for anyone else who may be using windows hosting and having trouble getting the config.inc.php set to read only.

    I am new to using MODx (just installed it and trying it out) and after install had the usual problem with windows hosting not being able to set the config.inc.php to read only. All you need to do is in notepad (or whatever you want) create a php file named chmod.php (I usually call it chmod.php just for simplicity you can call it fred.php if you like) with the following in it...

    <?php
    chmod("manager/includes/config.inc.php", 0444);
    ?> 


    Then upload the file to the root of your domain (and point your browser to the file eg. http://yourdomain.com/chmod.php . You should get a blank screen, if you do it worked. If you get a page not found error try with the www or without mine works without the www. Delete the file (its not needed once it has been used).

    You can use this for whatever file you need to set and for multiple files at one time just by adding another line as below...

    <?php
    chmod("manager/includes/config.inc.php", 0444);
    chmod("manager/includes/someotherfile.php",0777);
    ?> 


    I have used this to also fix the problem of not being able to delete files by setting them to 077.

    Hope this is of use to someone I find it a very usefull tool and more importantly very easy to use.
      • 534
      • 27 Posts
      Hi and thanks for the tip.
      I’m hosting on a windows server and i cant change the folder permissions to 777, as i understood is needed for the assets/image folder and the assets/cache folder. Ive tried your solution, but with no luck. Does it only work on files and not on folders?

      At least i don’t think it worked cause when i check the properties for the folder i tried to chmod it says 666.

      Any ideas?

      Thanks rolleyes
        • 2444
        • 4 Posts
        Quote from: adrock at Feb 05, 2007, 01:21 AM

        Hi and thanks for the tip.
        I’m hosting on a windows server and i cant change the folder permissions to 777, as i understood is needed for the assets/image folder and the assets/cache folder. Ive tried your solution, but with no luck. Does it only work on files and not on folders?

        At least i don’t think it worked cause when i check the properties for the folder i tried to chmod it says 666.

        Any ideas?

        Thanks rolleyes

        Not sure about if it works on folders but I see no point why it wouldnt you may have to experiment to see if it needs the trailing slash or not (eg myfolder/ or myfolder).

        I used it to set my config.inc.php file to read only which I couldnt do through my hosting. Although I did notice in the windows hosting I had (got rid of it now and gone to apache hosting) that it said my config.inc.php file was not read only although going by modxcms it was so maybe the windows hosting just doesnt show it right?

        Only thing I can suggest to see if it is really setting the permissions to 777 is try doing something that would only work is they are. I am new to modx so maybe one of the more experienced people here could tell you what to try.
          • 534
          • 27 Posts
          I’m changing to a UNIX account, it was a free service from my webhost. Then i can chmod the files and folders with my ftp program if i understand this right.

          Thanks for the help though smiley
            • 25420
            • 74 Posts
            Did the trick for me, thanks !
            • I hit this problem on my windows server which uses gene6ftp if anyone is interested in a gene6ftp script which can set a file read-only via command in an ftp client let me know.

              This has to be applied on the server though by a server admin or owner.
                http://www.onesmarthost.co.uk
                UK MODX Hosting with love.