Post by sherriw » Tue Mar 16, 2021 2:17 am

Can anyone confirm that symlinks in the config paths don't work?

If I set DIR_IMAGE to:

/var/www/mysite/releases/1/public/images/

It works. But if I use my symlink (current => releases/1) it doesn't load images:

/var/www/mysite/current/public/images/

I have double checked the paths & permissions, it's not that.

This is frustrating because many deployment tools use this kind of symlink to latest release strategy.

Thanks!

User avatar
Newbie

Posts

Joined
Wed Mar 03, 2021 9:16 pm

Post by sw!tch » Tue Mar 16, 2021 3:01 am

It's related to the path check in filemanger , search the forums this has been asked before.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by JNeuhoff » Tue Mar 16, 2021 7:09 pm

We often use an 'image' link defined in the admin folder which points to the 'image' folder. This makes it easier with the admin backend's summernote editor to show the images.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by paulfeakins » Tue Mar 16, 2021 7:13 pm

sherriw wrote:
Tue Mar 16, 2021 2:17 am
Can anyone confirm that symlinks in the config paths don't work?
You could use hard links.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by JNeuhoff » Tue Mar 16, 2021 7:49 pm

I just run a little PHP script one time from the admin folder to create a symbolic link:

Code: Select all

<?php
$target = '/home/xxxxx/public_html/image';
$shortcut = 'image';
symlink($target, $shortcut);
?> 
Works with most webhosts.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by sherriw » Wed Mar 17, 2021 1:33 am

For anyone having a similar problem if you use versioned deployments. I worked around this problem by having the 2 config files (public/config.php and public/admin/config.php) parse the real path from the symlink like so:

Code: Select all

// WorkAround - OpenCart doesn't support symlink paths.  Let PHP extract the actual path using readlink().
define('DEPLOY_PATH', readlink('/var/www/mysite/deploy/current') . '/');

// DIR
define('DIR_APPLICATION', DEPLOY_PATH . 'public/catalog/');
define('DIR_SYSTEM', DEPLOY_PATH . 'public/system/');
define('DIR_IMAGE', DEPLOY_PATH . 'public/image/');
define('DIR_STORAGE', DEPLOY_PATH . 'storage/');

User avatar
Newbie

Posts

Joined
Wed Mar 03, 2021 9:16 pm
Who is online

Users browsing this forum: NicNie and 214 guests