Installing Magento 2.4.7 on a Windows machine can seem complex, but with the right steps, you can have your eCommerce store up and running quickly. First, set up your local development environment by installing XAMPP, WAMP, or any suitable LAMP stack. Ensure PHP 8.1 or later is installed, as Magento 2.4.7 requires compatibility with specific PHP extensions like soap, gd, intl, and sockets. Next, configure Apache and MySQL within the stack and update the php.ini file by increasing the memory limit to 4GB, enabling essential extensions, and setting execution time limits. After configuring your server environment, create a virtual host for Magento by editing the httpd-vhosts.conf file and mapping it to a custom domain like magento.local. Don’t forget to update the hosts file in C:\Windows\System32\drivers\etc to point your domain to 127.0.0.1. Once the environment is ready, download and install
Composer, a dependency manager, and fetch Magento 2.4.7 using access keys from Magento Marketplace. During installation, configure database credentials, admin details, and set up Elasticsearch 7.x, a mandatory search engine for Magento. Run the setup commands to install Magento, reindex data, and deploy static content. Finally, disable two-factor authentication if required and troubleshoot any issues related to file paths or permissions. With Magento installed, you can access the admin panel and storefront, ready to customize your site and launch your online business. This streamlined process ensures optimal performance and compatibility on a Windows system.
1. Install Composer
- Download Composer from https://getcomposer.org/.
- Run the following command to update dependencies:
2. Windows Environment Setup
- Edit
hostsFile:- Open
C:\Windows\System32\drivers\etc\hosts. - Add the following line:
- Open
3. XAMPP Configuration
- Edit
php.iniFile:- Open
C:\xampp\php\php.ini. - Enable the following PHP extensions:
Increase memory limit:
- Open
- Create Virtual Host:Edit
C:\xampp822\apache\conf\extra\httpd-vhosts.confand add the following configuration:- Restart Apache using the XAMPP Control Panel.
4. Obtain Magento Access Keys
- Create an Account on Magento Marketplace:
- Go to Magento Marketplace.
- Click on Sign In > Create an Account and complete the registration.
- Obtain Access Keys:
- Go to My Profile > Access Keys (under the Marketplace tab).
- Click Create a New Access Key and name it (e.g., “Magento Setup Key”).
- Save the Public Key (username) and Private Key (password).
5. Download and Install Magento
- Configure Composer:
Replace
<public_key>and<private_key>with your Magento access keys. - Create Magento Project:
For specific Version : composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.6 magento
6. Install Elasticsearch
- Download Elasticsearch:
- Download Elasticsearch 7.x from https://www.elastic.co/downloads/elasticsearch.
- Configure Elasticsearch:
- Extract Elasticsearch to
C:\xampp822\htdocs\elasticsearch-7.16.3. - Open a terminal and navigate to the
binfolder: - Run Elasticsearch:
- Test Elasticsearch by visiting http://localhost:9200 in your browser.
- Extract Elasticsearch to
sample elasticsearch.yml code
cluster.name: my-application node.name: node-1 path.data: C:/xampp822/htdocs/elasticsearch-7.16.3/data path.logs: C:/xampp822/htdocs/elasticsearch-7.16.3/logs bootstrap.memory_lock: true network.host: 127.0.0.1 http.port: 9200 action.destructive_requires_name: true
7. Create Database
go to phpmyadmin and create one database
7. Troubleshoot Issues
- Fix
Gd2.phpValidation Issue: Modify the functionvalidateURLSchemeinvendor\magento\framework\Image\Adapter\Gd2.php: - Modify
di.xml(Symlink to Copy):- Open
app/etc/di.xml.Replace: - With:
- Open
- Fix
File\Validator.phpIssue: ModifyC:\xampp\htdocs\magento\vendor\magento\framework\View\Element\Template\File\Validator.php:
4. PluginListGenerator.php error while DI compile
Go to – vendor\magento\framework\Interception\PluginListGenerator.php
Find -> $cacheId = implode('|', $this->scopePriorityScheme) . "|" . $this->cacheId;
Replace -> $cacheId = implode('-', $this->scopePriorityScheme) . "-" . $this->cacheId;
8. Install Magento
Run the setup command:
For CMD single line
php bin/magento setup:install --base-url="http://magento.local/" --db-host="localhost:3306" --db-name="magento" --db-user="root" --db-password="admin" --admin-firstname="admin" --admin-lastname="admin" --admin-email="saz3sumar@gmail.com" --admin-user="admin" --admin-password="Admin123!" --language="en_US" --currency="USD" --timezone="America/Chicago" --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200 --use-rewrites=1
9. Post-Installation Commands
Run the following commands to finalize the setup:
10. Disable Two-Factor Authentication (Optional)
11. Install Sample Data (Optional)
If category image does not show the run this command
php bin/magento catalog:images:resize
Enable Developer Mode:
12. Elasticsearch Troubleshooting
- Disable Disk Threshold Checks:
- Clear Read-Only Blocks:
13. Test and Access
- Magento Storefront: http://acesoftech.local
- Magento Admin Panel: http://acesoftech.local/admin
Use the admin credentials you set during installation.
