Forum

Thread tagged as: Problem, Configuration

Adding assets causes me to log out

I'm having trouble adding assets within Perch. The behaviour of the Assets Apps suggests that something isn't configured right. Can you help?

So, I go to the Assets app. And under where it says "Listing all assets" there is nothing listed. I click "Add asset" and the box drops down. I drag my file into the box and for a split second the thumbnail appears. Then the box is empty. At this point I seem to have been logged out because if I click back to "Pages" or "Users" or whatever I am asked to log in again. If I check the default perch/resources directory the new file is in there.

So the assets are uploaded but not recorded? Any ideas? Thanks

Perch: 2.8.29, PHP: 5.3.29, MySQL: 5.6.22, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/ns/Dropbox/dev-server/od/1/perch
PERCH_CORE: /Users/ns/Dropbox/dev-server/od/1/perch/core
PERCH_RESFILEPATH: /Users/ns/Dropbox/dev-server/od/1/perch/resources
Image manipulation: GD
PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: od
DOCUMENT_ROOT: /Applications/AMPPS/www/od/1
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Nick L

Nick L 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Is there anything in your PHP error log?

Nick L

Nick L 0 points

Thanks Rachel,

It doesn't seem to be throwing any PHP errors.

But the server log says it's doing this:

127.0.0.1 - - [09/Jun/2016:12:53:24 +0100] "POST /perch/core/apps/assets/upload/ HTTP/1.1" 302 - "https://od/perch/core/apps/assets/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0"
127.0.0.1 - - [09/Jun/2016:12:53:24 +0100] "GET /perch?r=%2Fperch%2Fcore%2Fapps%2Fassets%2Fupload%2F HTTP/1.1" 301 276 "https://od/perch/core/apps/assets/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0"
127.0.0.1 - - [09/Jun/2016:12:53:24 +0100] "GET /perch/?r=%2Fperch%2Fcore%2Fapps%2Fassets%2Fupload%2F HTTP/1.1" 403 2051 "https://od/perch/core/apps/assets/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0"
Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks like your access log, which is possibly not the same place as PHP errors might be logged.

Do you have any other logs?

Nick L

Nick L 0 points

Hi Drew, there's nothing being reported in php_errors.log - no PHP errors as far as I can see.

Nick L

Nick L 0 points

The assets that I'm attempting to upload are all going in to the perch/resources folder successfully, but they aren't being listed in the Assets app. They should appear there right?.. if they're in the folder? I wondering if the app is looking in the wrong place. But that doesnt explain why I'm also being logged out.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you're being logged out, you're certainly encountering an error of some sort. If nothing is being logged it's going to come down to guess work.

What size are the images?

Nick L

Nick L 0 points

only small - between 19 and 182k.

I run AMPPS on my local drive and then in /Applications/ampps/www I have an alias that points to a Dropbox folder where I keep the actual site. Could that be causing a problem?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It could be, yes. By alias do you mean an old school Finder alias, or a symlink or something else?

Nick L

Nick L 0 points

symlink.

I guess I could back everything up and then recreate the site in www and then install Perch again. I guess if this issue hasnt come up before then it's one way to find out.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you not just point the virtual host directly at your Dropbox folder?

Nick L

Nick L 0 points

Apparently so! I will try that. Will I need to run setup again to ensure Perch knows about the new paths?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, you should be good if all the paths in your config/config.php file look to be accurate.

Nick L

Nick L 0 points

ok I have reconfigured the domain to point directly to the Dropbox folder and so now my diagnostics are:

 Perch: 2.8.29, PHP: 5.3.29, MySQL: 5.6.22, with PDO
    Server OS: Darwin, apache2handler
    Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29)
    App runtimes: <?php $apps_list = array( 'content', 'categories', );
    PERCH_LOGINPATH: /perch
    PERCH_PATH: /Users/ns/Dropbox/dev-server/od/2/perch
    PERCH_CORE: /Users/ns/Dropbox/dev-server/od/2/perch/core
    PERCH_RESFILEPATH: /Users/ns/Dropbox/dev-server/od/2/perch/resources
    Image manipulation: GD
    PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M
    F1: 2edba60ed1f613d6dd804feb202456a2
    Resource folder writeable: Yes
    HTTP_HOST: od
    DOCUMENT_ROOT: /Users/ns/Dropbox/dev-server/od/2
    REQUEST_URI: /perch/core/settings/diagnostics/
    SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Everything is working as before but Assets App still not working. Still logging me out.

Should I update PHP: 5.3.29 ??

Just tried something else - looking at the console when I try to add an asset...

POST https://od/perch/core/apps/assets/upload/

302 Found
        231ms   
jquery-... > eval (line 1)

301 Moved Permanently
        2ms 
GET https://od/perch/?r=%2Fperch%2Fcore%2Fapps%2Fassets%2Fupload%2F

403 Forbidden
        34ms

What does this mean?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Regardless of this error yes you should absolutely update PHP.

5.3 is end of lifed by a long way, gets no security updates, you don't want to be using it. As from Perch 2.9 we will require 5.4 as a minimum. Shop and Runway already require 5.4 (but don't go to 5.4 as that is also end-of-life) go to either 5.6 or ideally PHP 7.

Nick L

Nick L 0 points

Hi, ok will do. Thanks for you help on this.

Why would the "GET https://od/perch/?r=%2Fperch%2Fcore%2Fapps%2Fassets%2Fupload%2F" be giving a 403 error?

This seems like it might be the heart of the problem?

Nick L

Nick L 0 points

Hold up! Changed to PHP 5.6 and it worked :) Thanks so much.

Drew McLellan

Drew McLellan 2638 points
Perch Support

HTTP 403 is "Forbidden" - for some reason you were being logged out. It could have been a PHP config issue with the sessions that switching to 5.6 happened to resolve.

PHP 5.6 is a much better place to be, so you win on both counts.