skip to Main Content

I have a question, what is your local env configuration in Windows 10.
I tried to run magento2 on docker but it works very slow with the shared directory.
I know I can only share the "app" directory to speed things up.
But I wonder if there is a better approach to configuring dev env.

2

Answers


  1. Running Magento2 on Windows is bit tricky, but it is doable. I personally use XAMPP + system services for ElasticSeach, RabbitMQ and MySQL. For dev env I do not use Varnish and Redis.

    Supported versions for each service can be found in documentation here.

    After you have installed all services mentioned above (required is ElasticSearch and DB – MySQl or MariaDB – other ones are optional), you need to install Magento. Simple installation can look like:

    1. Clone project into htdocs folder in your xampp installation
    2. Install the project (composer install + bin/magento setup:install or whatever you use)
    3. You need to forbid symlinks for static content – as Windows cannot handle them.
      • This is done in app/etc/di.xml – find MagentoFrameworkAppViewAssetMaterializationStrategySymlink and replace it with MagentoFrameworkAppViewAssetMaterializationStrategyCopy
    4. You need to "fix" Magento to be able to work with Windows directory separator
      • Find method MagentoFrameworkViewElementTemplateFileValidator::isPathInDirectories
      • In this method, replace $this->fileDriver->getRealPath($path) with str_replace('\', '/', $this->fileDriver->getRealPath($path));
    5. You need to "fix" Magento and its image handling
      • Find method MagentoFrameworkImageAdapterGd2::validateURLScheme
      • There is one if statement – add !file_exists($filename) to this if statement

    After this, you should be able to use Magento 2 on Windows, but be aware there may be different issues as Windows is not supported officially (although I did not find any issue yet).

    Login or Signup to reply.
  2. Maybe a bit OT, but if you have access to run your development on a Mac, you can use warden (https ://warden.dev) – its very easy to use and will run a full environment for you with all services.

    It does filesync for the magento files, so you wont need to have it mounted to your machine’s local directory (removing the performance bottleneck).

    Ram is the most important thing, so if you can get an older Intel based mac-mini, it’s actually a cost-effective solution.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search