cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Magento 2 with no symlinks anywhere

How to use Magento 2 with no symlinks anywhere

There are 3 reasons I would like this, and I'd like to know if i'm missing out on anything which might hit me later down the line before I start.

 

1. Windows doesn't support them. I want to be able to clone local dev -> staging -> production sites, at will irrespective of host OS.

2. Subversion/Git/Other versioning systems can't track them. Same as 1 but add the VCS in too.

3. Its how every other CMS I used works. Take Joomla for example. Clone the sites files, export the db and there is only 1 config file to edit locally per site - everything else can be the same regardless of site location. With Magento, I know I have to build a db-specific version of the site each time (ugh) but with scripts it manageable. Using OS-specific symlinks borks that.

 

Please note - I'm the biggest Linux fan you could meet - this isn't an anti symlink rant.. I've set up the kind of sites described with a great workflow, I am just trying to get Magento 2 to fit in our dev process.

 

Bonus - is there a way to tell the Magento 2 installer before you start, on Linux, not to use Symlinks?

 

Thanks very much in advance.

3 REPLIES

Re: How to use Magento 2 with no symlinks anywhere

run this command

php -f /path/to/my/sample-data/dev/tools/build-sample-data.php -- --command=unlink --ce-source="/path/to/my/magento2"

Re: How to use Magento 2 with no symlinks anywhere

I am not sure about "anyware". However, you can copy assets instead of symbolic link creation in the next way: 

 

1) Open app/etc/di.xml

2) Replace all Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink occurrences with Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

Re: How to use Magento 2 with no symlinks anywhere

try this one:-

if your admin and front end link’s are not working, please follow the below steps to fix the same…

  1. Remove everything, except .htaccess file from pub/static folder
  2. Open up app/etc/di.xml find the path “Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink” and replace to “Magento\Framework\App\View\Asset\MaterializationStrategy\Copy”