Magento command for site with different version of PHP on aaPanel

Magento command for site with different version of PHP on aaPanel If default php version is 7.3 on aaPanel and your website is running on 7.2 use the following way to run commands /www/server/php/72/bin/php bin/magento setup:upgrade /www/server/php/72/bin/php bin/magento setup:di:compile /www/server/php/72/bin/php bin/magento setup:static-content:deploy

Enable template-hints directly from the terminal using a command in Magento 2

Enable template-hints with command in Magento 2 php bin/magento dev:template-hints:enable php bin/magento dev:template-hints:disable  Remove Cache chmod -R 777 var/ pub/ generated/ php bin/magento cache:clean php bin/magento cache:flush rm -rf var/generation/ var/view_preprocessed/ pub/static/frontend/ pub/static/_requirejs/ var/cache var/di var/page_cache pub/static/_cache  

Common Magento 2 terminal commands after installation or migration

Use the following commants on Magento 2 terminal /www/server/php/74/bin/php  -d memory_limit=-1  bin/magento setup:upgrade /www/server/php/74/bin/php  -d memory_limit=-1  bin/magento cache:clean /www/server/php/74/bin/php  -d memory_limit=-1  bin/magento indexer:reindex /www/server/php/74/bin/php  -d memory_limit=-1  bin/magento setup:static-content:deploy /www/server/php/74/bin/php  -d memory_limit=-1  bin/magento setup:static-content:deploy -f If your php is not default you need to find the PHP path first.

Magento 2 Migration : Could not validate a connection to Elasticsearch. No alive nodes found in your cluster

Magento 2 Migration Error #Start elastic on the server sudo -i service elasticsearch start If Elasticsearch is not installed, then install it the following way – #use the following. If you are using default php then just use php instead of “/www/server/php/74/bin/php“. /www/server/php/74/bin/php -d memory_limit=-1 bin/magento setup:upgrade /www/server/php/74/bin/php -d memory_limit=-1 bin/magento cache:clean /www/server/php/74/bin/php -d memory_limit=-1 […]

Calling a Custom phtml file in another phtml file, cms block, cms page, and XML layout in Magento 2

Calling a Custom phtml file in Magento 2 Calling in phtml file <?php include ($block->getTemplateFile(‘Magento_Theme::extra/test-view.phtml’)); ?> Calling in CMS page and block {{block class=”Magento\Framework\View\Element\Template” name=”test_view” template=”Magento_Theme::extra/test-view.phtml”}} Calling in XML layout <block class=”Magento\Framework\View\Element\Template” name=”test_view” template=”Magento_Theme::extra/test-view.phtml”/> Source:

Magento 2 Create Admin User via Command Line

Magento 2 Create Admin User php bin/magento admin:user:create –admin-user=mageplaza –admin-password=WeLoveMagento123 – –admin-firstname=Mageplaza –admin-lastname=Family Source:

Magento 2 Installation Guide

Magento 2 Installation Guide Install Elasticsearch before installing Adobe Commerce or Magento Open Source 2.4.0 Get the metapackage composer create-project –repository-url= magento/project-community-edition <install-directory-name> Set file permissions cd /var/www/html/<magento install directory> find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + find var generated vendor pub/static pub/media app/etc -type d -exec chmod […]