Skip to content

magento

How to Enable and Clear the Cache in Magento 2

Magento 2 features a powerful internal caching system. Enabling this cache ensures the best site speed and page load times, allowing customers to navigate the catalog and create orders quickly. Site caching simply creates better order transactions and less abandoned carts. To enable enable all Magento 2 Cache Types via command line, navigate to your site’s document root and type the following command: bin/magento cache:enable To check the status of Magento 2’s cache, type the following command: bin/magento cache:status To disable Magento 2’s Cache, type the following command: bin/magento cache:disable To clear Magento 2’s cache, type the following commands: bin/magento… Read More »How to Enable and Clear the Cache in Magento 2

Increase PHP Memory When Running Magento 2 Command

When running CLI commands on a Magento 2 installation the issue of memory can arise. For example, when running a composer command the memory limit will sometimes be reached, generating an error and the command being terminated. The ability to increase the PHP memory limit for that command only is needed. The following command is an example where I need to run upgrade composer, but need to increase the memory limit 2048 MB. php -d memory_limit=2048M /bin/composer upgrade

Create a Magento 2 Site Backup for Local Development

I often have to create a quick copy of a Magento 2 site to store on my local machine for development. Typically I only need the core files, extensions, themes, etc. Skipping the folders in the Magento 2 filesystem that aren’t needed for development will save a lot of disk space. The command below quickly creates a tar.gz backup of a root Magento 2 directory, skipping folders that aren’t relevant for local storage. Via SSH, navigate to the directory containing your root Magento 2 folder and enter: tar -zcvf html.tar.gz /path/to/html –exclude=html/generated –exclude=html/media –exclude=html/pub –exclude=html/var

Efficiency When Using Magento 2 Setup Commnds

Magento 2 requires a set of commands to be run after various changes to its installation, whether it be introducing a new extension or upgrading a current one. The following commands required to be run, and commonly run one after the other, are:

bin/magento setup:upgrade
bin/magento setup:static-content:deploy
bin/magento setup:di:compile

In the past I’ve been able to run these commands with little issue, but recently on one particular client’s multi-website Magento 2 installation, which has large cron jobs and higher traffic, the commands caused extremely high CPU usage. It seemed that running the commands with the other regular Magento 2 processes occurring in the background caused severe slow downs and regular site outages until PHP was restarted. In turn, this caused much frustration from both myself, the hosting company, and most importantly the client, who was losing dollars each time customers were unable to make purchases through their sites.Read More »Efficiency When Using Magento 2 Setup Commnds

Magento 2 File and Folder Permissions

Magento 2 requires specific permissions on the files and folders within its structure, along with correct ownership properties, to function properly. The owner of the file/folder system should have full control properties on all files and folders, meaning read/write/execute. Along with those properties, the specific permissions needed can be set using the following commands in the root directory of the Magento 2 installation: find . -type f -exec chmod 644 {} \; find . -type d -exec chmod 755 {} \; chmod u+x bin/magento