How to run magento 2 commands through php scripts or browser

We can run the command by making a file(e.g. commands.php) in the root or pub directory and add a command like as below:

$command1 = 'php -dmemory_limit=1G bin/magento setup:upgrade';

$command2 = 'php -dmemory_limit=1G bin/magento setup:di:compile';

$command3 = 'php bin/magento setup:static-content:deploy en_US -f';

$command4 = 'php -dmemory_limit=1G bin/magento cache:clean';

 

echo shell_exec($command1);

echo shell_exec($command2);

echo shell_exec($command3);

echo shell_exec($command4);

?>

Upload this file to the root of your website and run  http:example.com/commands.php

You can also remove or comment the commands which you do not need to run.

If you cache clean command you will get output on the browser as below:

Cleaned cache types:

config

layout

block_html

collections

reflection

db_ddl

compiled_config

eav

customer_notification

config_integration

config_integration_api

google_product

full_page

config_webservice

translate

vertex

0   0
Eecrets Magento
profile Nguyen 28th March 2024

i9bet is known as Asia's leading reputable bookmaker. With up to 100,000 players per day. Includes quick deposits and withdrawals for bettors to play freely. - please click here Readmore: i9bet

Thông tin Liên hệ:

Website:  https://i9bet.yachts/

Phone: 0901232567

Hastag: #i9bet #i9betyachts #trangchui9bet #gamei9bet

Địa chỉ: 340 Đ. Lũy Bán Bích, Hoà Thanh, Tân Phú, Thành phố Hồ Chí Minh Việt Nam

Write a comment ...
Post comment
Cancel
profile Nguyen 25th March 2024

Thank you very much! Because this is a very useful article for me. I received the right kind of information for my query. I have a project that I'm currently working on and I've been keeping an eye out for such information. This is the website containing that information. Readmore >>>33win

Map: 100 Phan Văn Hớn, Tân Thới Nhất, Quận 12, Thành phố Hồ Chí Minh, Việt Nam

Hotline: 0368988888

Website: https://33win.pics/

Email: 33winpics@gmail.com

Write a comment ...
Post comment
Cancel
profile Gambino 23rd March 2024

Numerous games, including those found on platforms like cool math games challenge players to strategize, adapt to evolving scenarios, and process information swiftly. These critical skills are not only crucial in gaming but also highly applicable and beneficial in various real-world contexts, enhancing problem-solving and decision-making abilities.

Write a comment ...
Post comment
Cancel
profile Nguyen 22nd March 2024

I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only. Thanks 789club

Map: 73 Chu Văn An, Phường 26, Bình Thạnh, Thành phố Hồ Chí Minh, Việt Nam

Hotline: 0321456763

Website: https://789av.club/

Email: 789avclubb@gmail.com

Hastag: #789av #789avclub #trangchu789av #nhacai789av #taigame789

Readmore

789 club

789club tài xỉu

tài xỉu 789club

Write a comment ...
Post comment
Cancel
profile Nguyen 21st March 2024

Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but other than that, this is excellent blog. Readmore: i9bet

Địa chỉ: 1083 Hiệp Nhất, Phường 4, Tân Bình, Thành phố Hồ Chí Minh, Việt Nam

Hotline: 0988877744

Website: https://i9bet.nl/

Email: i9betnl@gmail.com

Write a comment ...
Post comment
Cancel
profile Nguyen 21st March 2024

After study many of the blogs on your website now, and that i truly much like your technique of blogging. I bookmarked it to my bookmark internet site list and will be checking back soon. Readmore: 79king

Map: 247A Tân Kỳ Tân Quý, Tân Quý, Tân Phú, Thành phố Hồ Chí Minh, Việt Nam

Hotline:0987737333

Website: https://79king1.de/

Email:79kingde1@gmail.com

Hastag: #79king #79kingde #nhacai79king #linkvao79king #dangky79king

Write a comment ...
Post comment
Cancel
profile Nguyen 21st March 2024

You completed some good points there. I did a search on the issue and found a good number of people will consent with your blog. Readmore: 33win

Map: 580 Đ. Âu Cơ, Phường 10, Tân Bình, Thành phố Hồ Chí Minh, Việt Nam

Hotline: 0986446689

Website: https://33win.gold/

Email: 33wingold@gmail.com

Hastag: #33win #33wingold #nhacai33win cacuoc33win #33wincasino

Write a comment ...
Post comment
Cancel
profile Nguyen 20th March 2024

Surely, this website can quickly become famous among most bloggers and website builders because of those meticulous posts and reviews Readmore: jun88

Website: https://jun88.bond/

Địa chỉ: 253 Nguyễn Oanh, Phường 10, Gò Vấp, Thành phố Hồ Chí Minh, Việt Nam

Phone: 0342999954

Email: jun88bond1@gmail.com

Hastag: #jun88 #jun88bond #nhacaijun88 #linkjun88

Write a comment ...
Post comment
Cancel
profile super 19th March 2024

In the vast ocean of online gaming, where genres ranging from action-packed shooters to complex strategy games dominate, there exists a charming oasis that beckons players with its simple yet captivating premise – Watermelon Game

Write a comment ...
Post comment
Cancel
profile Nguyen 18th March 2024

Thanks for a blog. The above article is actually very interesting. I see you speak very clearly about the problem that needs to be resolved. I am having a similar project, may help, click this link for more details. Readmore: 789bet

Menu:

Website: https://789bet.yachts/

Email: 789betyachts@gmail.com

Hotline: 0901232345

Hastag: #789bet #789betyachts #game789bet #trangchu789bet

Write a comment ...
Post comment
Cancel
profile Shweta 12th March 2024

Start by clarifying your preferences and desires. Consider what qualities, physical attributes, personality traits, and High Class Delhi Escorts you are looking for in an Escort.

Write a comment ...
Post comment
Cancel
profile Nguyen 10th March 2024

Please let me know more information!!! Because I feel the information is still lacking. I found similar information on this website s666

Website: https://s666.quest/

Địa chỉ: 112 Võ Văn Ngân, Bình Thọ, Thủ Đức, Thành phố Hồ Chí Minh, Việt Nam

Hotline: 0348999956

Email: s666quest@gmail.com

Hastag: #s666 #s666quest #nhacais666 #s666casino

Write a comment ...
Post comment
Cancel
profile Nguyen 10th March 2024

Thank you very much for providing me with the necessary information. This is the information I really need. In addition, I also saw some websites that also have similar information to this link Readmore: mb66

Website: https://mb66.skin/

Địa chỉ: 30 Đ. Số 9, Phường 16, Gò Vấp, Thành phố Hồ Chí Minh, Việt Nam

Email: mb66skin@gmail.com

Hotline: 0321456787

Hastag: #mb66 #mb66skin #trangchumb66 #nhacaimb66

Write a comment ...
Post comment
Cancel
profile Nguyen 10th March 2024

This is an extremely useful thing for me. Because it helped me better understand this meaning. Thank you. I also have a few similar websites that can provide other useful information :. Readmore: 888b

Website: https://888b.quest/

Địa chỉ: 11 Bàu Cát 8, Phường 14, Tân Bình, Thành phố Hồ Chí Minh

Điện thoại: 0321456789

Email: 888bquest@gmail.com

Hastag: #888b #888bquest #trangchu888b #nhacai888b

Write a comment ...
Post comment
Cancel
profile zetisno 9th March 2024

Many games require players to 2048 cupcakes strategize, adapt to new situations, and analyze information quickly, all of which are valuable skills applicable in various aspects of life.

Write a comment ...
Post comment
Cancel

Related Post

7th October 2020

Create a custom log file in Magento 2

Create a custom log file in Magento 2....

read more reply

7th October 2020

Magento 2 Direct SQL Queries in Zend Format

Sometimes due to some project requirments, we need to directly communicate with Magento2 Database and we have to write SQL queries for that.....

read more reply

11th June 2020

Issues in upgrading magento 2 to latest versions

Share your issues/suggestions for upgrade Magento 2 to the latest versions.....

read more reply

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site