We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31640
    • 100 Posts
    I am having a big issue with a website that must go live as soon as possible....

    The customer is uploading images and he permissions are 600.
    But i defined in modx
    new_file_permissions: 644
    new_folder_permissions: 755

    I had contact with the hosting provider and they said that they are running suPHP
    (i am a developper, so i don’t know this hosting stuff)
    On my own hosting account everything works fine...

    Could anyone help??
    Is modx incompatible with suPHP or could this be resolved???
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      If you’re a developer for the web, you’d better learn about "this hosting stuff"; it’s part of working on the web.

      http://www.zzee.com/solutions/unix-permissions.shtml

      suPHP means they’re using an Apache module that switches user (the su part) from the webserver user (apache, www, or nobody, depending on how the server is configured) to the owner of the .php file. The owner is usually the same user as the FTP user. This way you don’t have to have any files or folders set with world-writable permissions so that the .php scripts can upload or edit files.



      Different servers have things configured differently; they may require certain permissions on files and folders to help prevent "others" from accessing "your" files and folders.

      You don’t say exactly how the customer is uploading these images.
        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
        • 31640
        • 100 Posts
        @sottwell: i know the unix permissions, but i didn’t know the suPHP module.
        So today I learned something new smiley

        The customer is uploading images using a template variable of the type ’image’
          • 3749
          • 24,544 Posts
          What snippet are you using to upload the images?
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            BobRay, it’s an "image" type TV. Hmmm. That’s using MCPuk. It uses (or tries to) the file permissions set in the Configuration to set the permissions for the newly-moved uploaded file. If that’s not working, then something is either overriding it or blocking the change.
            												(move_uploaded_file($_FILES['NewFile']['tmp_name'],($this->real_cwd."/$filename($i).$ext"))) {
            													@chmod(($this->real_cwd."/$filename($i).$ext"),$this->fckphp_config['modx']['file_permissions']); //modified for MODx
            

            You can see what these permissions should be in your site’s cache file:
            $c[’new_file_permissions’] = "0644";
            $c[’new_folder_permissions’] = "0755";
              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
              • 31640
              • 100 Posts
              I looked in the file:
              htdocs/core/cache/config.cache.php

              and found the following:
              ’new_folder_permissions’ => ’0755’,
              ’new_file_permissions’ => ’0644’,

              so that seems ok...

              Any other ideas???
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Then something in the server or PHP configuration is overriding or blocking the attempt to change the permission of the uploaded file.

                I believe that the original permission of the temporary file (the one that gets uploaded, then moved) is 0600; the move_uploaded_file will maintain that setting, then the next line should be modifying the permissions. That obviously is not happening.
                  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
                  • 1004
                  • 5 Posts
                  i have the same problem.
                  the owner is set to apache instead of my ftp account name.
                  i have some stuff running on Joomla and the problem was fixed by setting ftp user and password in administration... is there something in ModX, or it uses different algorithms?
                    • 1004
                    • 5 Posts
                    there is another problem during installation, that i found just right now: i’ve unchecked the option saying that i have already unpacked the core.transport.zip, and ModX cannot do this by self, saying
                    Warning: ZipArchive::extractTo(/home/***/domains/***.ru/public_html/core/packages//core/manifest.php) [ziparchive.extractto]: failed to open stream: Permission denied in /home/***/domains/***.ru/public_html/core/xpdo/compression/xpdozip.class.php on line 142