We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51428
    • 42 Posts
    Hi once again. One more question.
    It is also said in the manual: "Before running setup, make sure your core/cache/ and core/config/ directories are writable by PHP". The key words that surprise me are "by PHP". How am I supposed to check this possibility? On my VDS I have permission types "for owner", "for groups" and "for those not in groups and not the owner", but I don't have any permissions for PHP (or I just don't know where to search). And those folders btw have the same permissions as the others.

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That can be a tricky subject. It all depends on how PHP is invoked by your web server when it finds itself loading a .php file, and how the server handles permissions.

      At its most basic, the web server will invoke the PHP interpreter using its own user (the web server's user). Thus if you have installed MODX, all of its files and folders will be owned by your user, not the web server user.

      In such a case, the folders and files that MODX (a .php script) needs to write to need to have world-writable permissions (777 and 666), since they are owned by you but will use the web server's user.

      It is now rare to find such a basic configuration in hosting servers. In most cases now there is a server configuration to run any scripts such as .php scripts as the same user as the script's owner. This means that the files and folders only need write permission for the owner.

      If you see that the files and folders are set to permissions like 755 for folders and 644 for files, it almost certainly means the scripts will run as their owner and you'll have no problems.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • discuss.answer
        • 3749
        • 24,544 Posts
        As Susan says, it's rarely a problem, especially if you use a MODX-friendly host. If you want to check, though, you can create a test.php file in the MODX root with this code:


        <?php
        $dirs = array(
            'core/cache',
            'core/config',
        );
        
        foreach ($dirs as $dir) {
           echo '<br />';
           if (is_writable($dir)) {
              echo $dir . ' is writable';
           } else {
              echo $dir . ' is NOT writable';
           }
        }
        


        Then visit yoursite.com/test.php to find out.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 51428
          • 42 Posts
          Quote from: sottwell at Nov 24, 2015, 10:16 PM

          If you see that the files and folders are set to permissions like 755 for folders and 644 for files, it almost certainly means the scripts will run as their owner and you'll have no problems.
          So, to be sure everything will work fine I should set 755 for the folders themselves and 644 for their files (for the owner), shouldn't I?
          BobRay, thank you for the script. I'll do the test also.