{"id":6657,"date":"2020-11-13T05:58:22","date_gmt":"2020-11-13T05:58:22","guid":{"rendered":"https:\/\/www.bay20.com\/?p=6657"},"modified":"2025-05-01T18:09:30","modified_gmt":"2025-05-01T12:24:30","slug":"fuhren-sie-den-magento-2-befehl-im-stammverzeichnis-mit-php-skript-aus","status":"publish","type":"post","link":"https:\/\/www.bay20.com\/de\/fuhren-sie-den-magento-2-befehl-im-stammverzeichnis-mit-php-skript-aus\/","title":{"rendered":"F\u00fchren Sie Magento 2 Befehl auf Root-Verzeichnis mit PHP-Skript"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Folgen Sie den nachstehenden Anweisungen, um die magento 2-Befehle auszuf\u00fchren:<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>Erstellen Sie eine neue Datei im <strong>Magento 2-Stamm<\/strong>verzeichnis (command.php).<\/li><li>F\u00fcgen Sie die folgenden Codes in die <strong>neu<\/strong> erstellte Datei ein.<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-verse\">&lt;?php\nuse Magento\\Framework\\App\\Bootstrap;\nrequire 'app\/bootstrap.php';\n$bootstrap = Bootstrap::create(BP, $_SERVER);\n$objectManager = $bootstrap-&gt;getObjectManager();\n$state = $objectManager-&gt;get('Magento\\Framework\\App\\State');\n$state-&gt;setAreaCode('frontend');\n\/\/command code here\n\/*shell_exec('your_magento_2_commands');\n<strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--OR--<\/strong>\nsystem('your_magento_2_commands'); &nbsp;\n*\/\n\/* system('php bin\/magento setup:upgrade');\nsystem('php bin\/magento setup:static-content:deploy -f');\nsystem('php bin\/magento indexer:reindex');\nsystem('php bin\/magento cache:flush');\nsystem('php bin\/magento cache:clean');\necho \"Your Commands have been run successfully.\";\n*\/\n<strong>\/*--OR--*\/<\/strong>\nshell_exec('php bin\/magento setup:upgrade');\nshell_exec('php bin\/magento setup:static-content:deploy -f');\nshell_exec('php bin\/magento indexer:reindex');\nshell_exec('php bin\/magento cache:flush');\nshell_exec('php bin\/magento cache:clean');\necho \"Your Commands have been run successfully.\";\n&nbsp; &nbsp;\/\/<strong>file ends here<\/strong>\n?&gt;<\/pre>\n\n\n\n<p>3. F\u00fchren Sie nun diese neu erstellte Datei im Browser mit folgender URL aus: your_base_url\/command.php (<strong>neue Datei<\/strong>)                             <\/p>\n\n\n\n<p>4. Jetzt wurden Ihre <strong>Befehle<\/strong> erfolgreich ausgef\u00fchrt, wie auf dem folgenden <strong>Screenshot<\/strong> zu sehen ist.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"943\" height=\"166\" src=\"https:\/\/www.bay20.com\/wp-content\/uploads\/2020\/11\/command.jpg\" alt=\"\" class=\"wp-image-6667\" srcset=\"https:\/\/www.bay20.com\/de\/wp-content\/uploads\/2020\/11\/command.jpg 943w, https:\/\/www.bay20.com\/de\/wp-content\/uploads\/2020\/11\/command-300x53.jpg 300w, https:\/\/www.bay20.com\/de\/wp-content\/uploads\/2020\/11\/command-800x141.jpg 800w, https:\/\/www.bay20.com\/de\/wp-content\/uploads\/2020\/11\/command-768x135.jpg 768w, https:\/\/www.bay20.com\/de\/wp-content\/uploads\/2020\/11\/command-805x142.jpg 805w\" sizes=\"auto, (max-width: 943px) 100vw, 943px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Folgen Sie den nachstehenden Anweisungen, um die magento 2-Befehle auszuf\u00fchren: Erstellen Sie eine neue Datei im Magento 2-Stammverzeichnis (command.php). F\u00fcgen Sie die folgenden Codes in die neu erstellte Datei ein. &lt;?php use Magento\\Framework\\App\\Bootstrap; require &#8218;app\/bootstrap.php&#8216;; $bootstrap = Bootstrap::create(BP, $_SERVER); $objectManager = $bootstrap-&gt;getObjectManager(); $state = $objectManager-&gt;get(&#8218;Magento\\Framework\\App\\State&#8216;); $state-&gt;setAreaCode(&#8218;frontend&#8216;); \/\/command code here \/*shell_exec(&#8218;your_magento_2_commands&#8216;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [&hellip;]<\/p>\n","protected":false},"author":43,"featured_media":6681,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88,79],"tags":[],"class_list":["post-6657","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-entwicklung","category-magento-anleitung"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts\/6657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/comments?post=6657"}],"version-history":[{"count":13,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts\/6657\/revisions"}],"predecessor-version":[{"id":16627,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/posts\/6657\/revisions\/16627"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/media\/6681"}],"wp:attachment":[{"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/media?parent=6657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/categories?post=6657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bay20.com\/de\/wp-json\/wp\/v2\/tags?post=6657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}