We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10529
    • 73 Posts

    Been beating myself up all weekend, did submit a question re treasure chest 1.0 & FDN asking if they work on version 1.0.3 - but I persevered and managed I thought to get TreasureChest 1.0 working, that involved having to FTP individual files & folders, though did have an error message sayoing could not unlink index.php - so was feeling really good to see it all there but when I went to add an image to a product I got the following message on saving - I’ve looked at the processors/execute_module but there’s only a 128 lines of code, (not that I would know what to do with it)

    Warning: copy(/home/richards/public_html/assets/snippets/treasure_chest/images/products/sign1.jpg) [function.copy]: failed to open stream: Permission denied in /home/richards/public_html/manager/processors/execute_module.processor.php(114) : eval()’d code on line 378

    I also tried loading it to a server running 1.0.2 and had the same error

    Warning: copy(/home/wwwanoth/public_html/assets/snippets/treasure_chest/images/products/sign1.jpg) [function.copy]: failed to open stream: Permission denied in /home/wwwanoth/public_html/manager/processors/execute_module.processor.php(114) : eval()’d code on line 378

    I have changed permissions on all the images & phpthumb files / directories

    Is there a "fix" to this - or have I wasted all weekend (again smiley)
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The problem is on line 378 of the code being evaluated by execute_module.processor.php, not on line 378 of execute_module.processor.php itself. In this case, it means that line of the module code (most likely the included .php code).

        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
        • 10529
        • 73 Posts
        Thanks for the response - I’ve looked at various files in assets/snippets/treasure_chest and I would presume that the culprit is in treasurechest.module.php (line 378 is in bold) however I have no idea where to start to implement a fix - is it possible?

        $image_name = strtolower(str_replace(’ ’,’_’, $_FILES[’image’][’name’]));
        $image = ’assets/snippets/treasure_chest/images/products/’.$image_name;
        if (copy($_FILES[’image’][’tmp_name’], $modx->config[’base_path’].$image)) $_POST[’image’] = $image;
        else $_POST[’image’] = ’error’;

        I looked at the config file in php.thumb.config and I suspect it’s related to the above

        // START USER CONFIGURATION SECTION:

        // * DocumentRoot configuration
        // phpThumb() depends on $_SERVER[’DOCUMENT_ROOT’] to resolve path/filenames. This value is usually correct,
        // but has been known to be broken on some servers. This value allows you to override the default value.
        // Do not modify from the auto-detect default value unless you are having problems.
        //$PHPTHUMB_CONFIG[’document_root’] = ’/home/httpd/httpdocs’;
        //$PHPTHUMB_CONFIG[’document_root’] = ’c:\\webroot\\example.com\\www’;
        //$PHPTHUMB_CONFIG[’document_root’] = $_SERVER[’DOCUMENT_ROOT’];
        //$PHPTHUMB_CONFIG[’document_root’] = realpath((@$_SERVER[’DOCUMENT_ROOT’] && file_exists(@$_SERVER[’DOCUMENT_ROOT’].$_SERVER[’PHP_SELF’])) ? $_SERVER[’DOCUMENT_ROOT’] : str_replace(dirname(@$_SERVER[’PHP_SELF’]), ’’, str_replace(DIRECTORY_SEPARATOR, ’/’, realpath(’.’))));
        $PHPTHUMB_CONFIG[’document_root’] = realpath((getenv(’DOCUMENT_ROOT’) && ereg(’^’.preg_quote(realpath(getenv(’DOCUMENT_ROOT’))), realpath(__FILE__))) ? getenv(’DOCUMENT_ROOT’) : str_replace(dirname(@$_SERVER[’PHP_SELF’]), ’’, str_replace(DIRECTORY_SEPARATOR, ’/’, dirname(__FILE__))));


        Thanks in advance
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          What happens here is that the file is uploaded to a system-specific temporary location, and PHP has to move it from that temporary location to its final location. For some reason PHP is not able to access this temporary file upload location, or is mis-identifying what that location should be.

          http://www.php.net/manual/en/features.file-upload.post-method.php
            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
            • 10529
            • 73 Posts
            Sottwell have sent you an email as this is all way above my head - I think maybe if I chnage these lines to something that might be the answer but I really have no idea?

            //$PHPTHUMB_CONFIG[’document_root’] = ’/home/httpd/httpdocs’;
            //$PHPTHUMB_CONFIG[’document_root’] = ’c:\\webroot\\example.com\\www’;
              • 10529
              • 73 Posts
              Ok asked my really helpful techies at KNet Hosting http://www.knethosting.co.uk/ to take a look and the superstars they are sussed it.....this is what Nick had to do..........

              I had to change the group permissions also as the folder is owned by you and unless you change the directory to 777 (which is not really an ideal solution) then it still would not work, in the end I change the group owner to the web server and the permission 775.

              So now hopefully will be able to get to grips with it