• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Can't write into target dir

Status
Not open for further replies.

mamedov

Chevereto Member
1) Nginx as reverse proxy (1.8 stable), Apache (backend same server) 2.2.15, mod_php, PHP 5.6.18 with all required modules. MySQL Server 5.7.11. Folder permission 777 /content, /images. Works fine, but after configure External Storage via SFTP protocol, Chevereto not work properly. SFTP works fine and connection is established.
2) second server for storage, DNS A Record cdn1.example.com
Apache (error_log):
1) Can't write into target dir., referer: http://example.com/dashboard/settings/external-storage
2) Can't fetch file header from external storage server: http://cdn1.example.com/2016/03/11/Linux_Red_Hat.png (404), referer: http://example.com/search/images/?q=storage:external
 
Last edited:
Can't write into target dir means that there is a permission issue that doesn't allow the write action. Check permissions for that account in the external server.

"Can't fetch file header from external storage server" appears on route.image.php and 404 means that the image can't be found in that URL.
 
Rodolfo, can I send server credentials in order to check this issue and investigate for features? Thanks
 
Sure, but we are out of support hours. I will check it sometime in the weekend.
 
exception 'CHV\\SftpException' with message 'Can't upload 'Chevereto_test_2016-03-11_09h34m11s.png' in CHV\\Sftp::put' in /var/www/album/public_html/app/lib/classes/class.sftp.php:89\nStack trace:\n#0 /var/www/album/public_html/app/lib/classes/class.storage.php(178): CHV\\Sftp->put(Array)\n#1 /var/www/album/public_html/app/lib/classes/class.storage.php(342): CHV\\Storage::uploadFiles(Array, Array)\n#2 /var/www/album/public_html/app/lib/classes/class.storage.php(407): CHV\\Storage::test(Array)\n#3 /var/www/album/public_html/app/routes/route.json.php(726): CHV\\Storage::insert(Array)\n#4 /var/www/album/public_html/lib/G/classes/class.handler.php(216): G\\Handler->{closure}(Object(G\\Handler))\n#5 /var/www/album/public_html/lib/G/classes/class.handler.php(120): G\\Handler->processRequest()\n#6 /var/www/album/public_html/app/loader.php(400): G\\Handler->__construct(Array)\n#7 /var/www/album/public_html/index.php(20): include_once('/var/www/album/...')\n#8 {main}, referer: http://example.com/dashboard/settings/external-storage
 
exception 'CHV\\SftpException' with message 'Can't upload 'Chevereto_test_2016-03-11_09h34m11s.png' in CHV\\Sftp::put' in /var/www/album/public_html/app/lib/classes/class.sftp.php:89\nStack trace:\n#0 /var/www/album/public_html/app/lib/classes/class.storage.php(178): CHV\\Sftp->put(Array)\n#1 /var/www/album/public_html/app/lib/classes/class.storage.php(342): CHV\\Storage::uploadFiles(Array, Array)\n#2 /var/www/album/public_html/app/lib/classes/class.storage.php(407): CHV\\Storage::test(Array)\n#3 /var/www/album/public_html/app/routes/route.json.php(726): CHV\\Storage::insert(Array)\n#4 /var/www/album/public_html/lib/G/classes/class.handler.php(216): G\\Handler->{closure}(Object(G\\Handler))\n#5 /var/www/album/public_html/lib/G/classes/class.handler.php(120): G\\Handler->processRequest()\n#6 /var/www/album/public_html/app/loader.php(400): G\\Handler->__construct(Array)\n#7 /var/www/album/public_html/index.php(20): include_once('/var/www/album/...')\n#8 {main}, referer: http://example.com/dashboard/settings/external-storage

Anytime you use external storage Chevereto will only connect and issue commands to that server. Are you following me right? Chevereto is only a peer of this sftp session.

Chevereto connects to this server, if you provide a limited account, or maybe a wrong path or anything like that, the external storage won't work as expected. In this case the server credentials are OK, but that doesn't means that the system couldn't face more issues like permissions, maybe wrong path, etc.

SFTP doesn't provide full debug information, the protocol is plain as "OK 200", "ERR". In this case the library is saying that the put command didn't worked, which is often related to a limited account that can't upload files or perform some commands or that the server path can't be modified by the provided SFTP auth. Even if the SFTP account is good and the connection and everything works neat, the external server could limit the local server (where you run the script) and again, the script can't do anything because that is way below the script layer.

Since a SFTP external server is well, external, Chevereto can't fix those permissions issues and the thing that you can do is check use the very same server details and try using an SFTP software to see if everything works. If it works for you then send me the SFTP credentials and I will test the SFTP among my Chevereto installs. If keeps failing at least I will be able to get to the source of the problem.
 
Last edited:
After reviewing the access I can tell that the images are being stored and the problem is the URL resolution. The URL provided doesn't resolve to that folder, that's why you have 404 error.

This is the image being called by Chevereto (listing)
URL_CALL.JPG

And this is the response when you request that image. 404 means that in that URL that resource can't be found.
URL_404.JPG

But, the resource exists in the SFTP server:
SFTP_FILE.JPG

The problem is the URL you are providing. That URL doesn't resolve to the sever path where you are uploading the images. You need to provide an URL that resolves to that path, so when you enter an image URL in your browser, the server resolves that image. In this case the problem is that the URL you provided resolves to another path in the server. Most likely it has a virtual host configuration pointing somewhere else.

Even if the SFTP server says domain.<nic> it doesn't means that anything you upload there will resolve to domain.<nic>/filepath.<ext>. That's because SFTP is just the connection protocol and HTTP is the protocol that resolves URL. If that website was configured for another path, HTTP won't use the same path as when you connect using SFTP.

Like I said, you need to provide an URL that resolves that SFTP path. Create a subdomain or someting that points there.
 
Status
Not open for further replies.
Back
Top