#magento2命令安装
php -dmemory_limit=8G bin/magento setup:install --base-url=http://localhost/
–db-host=localhost --db-name=magento --db-user=root --db-password=
–backend-frontname=admin --admin-firstname=admin --admin-lastname=admin
–admin-email=xxxx@xx.com --admin-user=admin --admin-password=admin123
–language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1
错误:You need to configure Two-Factor Authorization in order to proceed to your store’s admin area
bin/magento module:disable Magento_TwoFactorAuth
bin/magento cache:flush
开启/关闭维护模式
开启命令:php magento maintenance:enable
关闭命令:magento maintenance:disable
查看状态:magento maintenance:status
magento2 开启/关闭开发模式
bin/magento deploy:mode:show // 查看当前模式
bin/magento deploy:mode:set developer // 设置为开发模式
bin/magento deploy:mode:set production // 设置为生产模式
#查看linux版本 lsb_release -a
cat /etc/redhat-release
#运行环境切换
#查看环境 php bin/magento deploy:mode:show
#切换到开发者环境 php bin/magento deploy:mode:set developer
#切换到生产环境 php bin/magento deploy:mode:set production
php bin/magento module:enable --clear-static-content KC_Demo
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
#部署编译
#更新di php bin/magento setup:di:compile
#更新数据 php bin/magento setup:upgrade
#静态部署 php bin/magento setup:static-content:deploy -f
#静态部署日语 php bin/magento setup:static-content:deploy ja_JP -f
#清除缓存 php bin/magento cache:clean
#模块
#查看模块 php bin/magento module:status
#开启模块 php bin/magento module:enable
#关闭模块 php bin/magento module:disable
查看插件列表
php bin/magento module:status
启用插件并安装插件数据
php bin/magento module:enable --clear-static-content Mageplaza_SocialLogin
php bin/magento setup:upgrade
php bin/magento setup:di:compile
如果是默认模式或者生产模式的话,需要deploy下
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:static-content:deploy -f
#cron job
#安装 php bin/magento cron:install --force
#运行 php bin/magento cron:run
#删除 php bin/magento cron:remove
#队列
#开启队列 php bin/magento queue:consumers:start
#查看队列任务 php bin/magento queue:consumers:list
#启动导出队列 php bin/magento queue:consumers:start exportProcessor
#创建后台管理人员
#创建用户 php bin/magento admin:user:create
#解锁用户状态 php bin/magento admin:user:unlock
#索引
#查看索引 php bin/magento indexer:status
#刷新索引 php bin/magento indexer:reindex
#刷新商品索引 php bin/magento indexer:reindex catalogsearch_fulltext
#重置索引 php bin/magento indexer:reset
#计划任务jobs php bin/magento cron:install --force
# php bin/magento cache:flush
# php bin/magento cron:run
https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-cron.html#create-or-remove-the-magento-crontab
#安全策略
#禁用安全策略 php bin/magento module:disable Magento_Csp
#切换到产品模式
bin/magento deploy:mode:set production
cd ~/www
rm -rf ./var/cache/
rm -rf ./var/generation/
rm -rf ./var/log/
rm -rf ./var/maps/
rm -rf ./var/page_cache/
rm -rf ./var/tmp/
rm -rf ./var/view/
rm -rf ./var/view_preprocessed/
php bin/magento setup:di:compile
php bin/magento setup:upgrade
php bin/magento cache:flush
rm -rf ./pub/static/*
php bin/magento setup:static-content:deploy
#切换到开发模式
php bin/magento deploy:mode:set developer
或修改.htaccess SetEnv MAGE_MODE developer
#查看模式
bin/magento deploy:mode:show
#强制https
bin/magento config:set web/secure/enable_upgrade_insecure 1
#强制https
bin/magento config:set web/secure/enable_upgrade_insecure 1
magento2 如何卸载模块
1.如果您手动安装:
- 删除文件夹:app/code/<Vendor>/<Module>
- 从数据库中删除模块表
- 删除配置设置。
DELETE FROM core_config_data WHERE path LIKE 'vendor_module/%'
删除app/etc/config.php文件中_信息
删除setup_module表中_信息
DELETE FROM setup_module WHERE module='<Vendor>_<Module>'
2.如果您通过composer安装:
在命令行运行:
php bin/magento module:uninstall -r <Vendor>_<Module>