Base directory paths
Last update: November 22, 2024
- Topics:
- Configuration
CREATED FOR:
- Experienced
- Admin
- Developer
The MAGE_DIRS
environment variable enables you to specify custom base directory paths and fragments of base URLs that are used by the Commerce application to build absolute paths to various files or for generating URLs.
Set MAGE_DIRS
Specify an associative array where keys are constants from \Magento\App\Filesystem\DirectoryList and values are absolute paths of directories or their URL paths, respectively.
You can set MAGE_DIRS
in any of the following ways:
-
Use a custom entry point script such as the following:
<?php /** * Copyright [first year code created] Adobe * All Rights Reserved. */ use Magento\Framework\App\Bootstrap; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\Http; require __DIR__ . '/app/bootstrap.php'; $params = $_SERVER; $params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [ DirectoryList::PUB => [DirectoryList::URL_PATH => ''], DirectoryList::MEDIA => [DirectoryList::PATH => '/mnt/nfs/media', DirectoryList::URL_PATH => ''], DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'], DirectoryList::UPLOAD => [DirectoryList::URL_PATH => '/mnt/nfs/media/upload'], DirectoryList::CACHE => [DirectoryList::PATH => '/mnt/nfs/cache'], ]; $bootstrap = Bootstrap::create(BP, $params); /** @var Http $app */ $app = $bootstrap->createApplication(Http::class); $bootstrap->run($app);
The preceding example sets paths for [cache]
and [media]
directories to /mnt/nfs/cache
and /mnt/nfs/media
, respectively.
Previous pageProfiling
Next pageDeployment overview
Commerce
- Overview
- General setup
- Deployment
- Cache
- Command Line
- Command-line tool
- Common commands
- Enable logging
- Manage the cache
- Manage indexers
- Configure cron jobs
- Compile code
- Operation mode
- Start message queue consumers
- URN highlighter
- Dependency reports
- Localization
- Configuration management
- Static view
- Create symlinks
- Run unit tests
- Convert layout files
- Generate data for performance testing
- Run support utilities (Commerce only)
- Configuration files
- Configuration paths
- Cron Jobs
- Logs
- Message Queues
- Multiple sites
- Search Engine
- Security
- Storage
- Return to Operational Guides