How to run external script outside of magento 2 root directory? Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Magento 1.9.2.1 Cron Not WorkingMagento 2 admin url gives error - Class MagentoAuthorizationModelRoleFactory does not existmagento 2 setup freezes browserCron Permissions Error Magento2Running Cron Scripts From a Sub-directoryReadiness check didn't have a problem, but update.log complains about non-writable pathsMagento 2 Cron PHP Parse ErrorHelp with Cron on Magento 2Run custom PHP file via Cron jobMagento 2 - Make log file accessible from browser
How do I make this wiring inside cabinet safer?
Should I use a zero-interest credit card for a large one-time purchase?
Is CEO the "profession" with the most psychopaths?
How do living politicians protect their readily obtainable signatures from misuse?
How to compare two different files line by line in unix?
What was the first language to use conditional keywords?
Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?
Chebyshev inequality in terms of RMS
How would a mousetrap for use in space work?
Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?
Is there any word for a place full of confusion?
Localisation of Category
Do I really need to have a message in a novel to appeal to readers?
Can an alien society believe that their star system is the universe?
How could we fake a moon landing now?
How can I reduce the gap between left and right of cdot with a macro?
Is it fair for a professor to grade us on the possession of past papers?
A term for a woman complaining about things/begging in a cute/childish way
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
Chinese Seal on silk painting - what does it mean?
Did Krishna say in Bhagavad Gita "I am in every living being"
Most bit efficient text communication method?
How does light 'choose' between wave and particle behaviour?
What do you call the main part of a joke?
How to run external script outside of magento 2 root directory?
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Magento 1.9.2.1 Cron Not WorkingMagento 2 admin url gives error - Class MagentoAuthorizationModelRoleFactory does not existmagento 2 setup freezes browserCron Permissions Error Magento2Running Cron Scripts From a Sub-directoryReadiness check didn't have a problem, but update.log complains about non-writable pathsMagento 2 Cron PHP Parse ErrorHelp with Cron on Magento 2Run custom PHP file via Cron jobMagento 2 - Make log file accessible from browser
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have made a few external php scripts to update quantity and tracking numbers,etc Right now, i'm putting them in magento root and set the permission to 640. However, it's still accessible by the browser. I would like to make it accessible by cron and the owner/group only.
I tried to move the script to
magentoroot/script/
, and change the following in the script:
$file = fopen('../../qty.csv', 'r', '"');
require DIR . '../app/bootstrap.php';
$writer = new ZendLogWriterStream(BP .
'../var/log/import-update.log');
then the script stop working. what should i change in the file?
<?php $file = fopen('../qty.csv', 'r', '"'); // set path to the CSV file
if ($file !== false) {
require __DIR__ . '/app/bootstrap.php';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('adminhtml');
// used for updating product info
$productRepository = $objectManager->get('MagentoCatalogModelProductRepository');
// used for updating product stock
$stockRegistry = $objectManager->get('MagentoCatalogInventoryApiStockRegistryInterface');
// add logging capability
$writer = new ZendLogWriterStream(BP . '/var/log/import-update.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
.....
.....
.....
magento2 cron permissions script file-permissions
add a comment |
I have made a few external php scripts to update quantity and tracking numbers,etc Right now, i'm putting them in magento root and set the permission to 640. However, it's still accessible by the browser. I would like to make it accessible by cron and the owner/group only.
I tried to move the script to
magentoroot/script/
, and change the following in the script:
$file = fopen('../../qty.csv', 'r', '"');
require DIR . '../app/bootstrap.php';
$writer = new ZendLogWriterStream(BP .
'../var/log/import-update.log');
then the script stop working. what should i change in the file?
<?php $file = fopen('../qty.csv', 'r', '"'); // set path to the CSV file
if ($file !== false) {
require __DIR__ . '/app/bootstrap.php';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('adminhtml');
// used for updating product info
$productRepository = $objectManager->get('MagentoCatalogModelProductRepository');
// used for updating product stock
$stockRegistry = $objectManager->get('MagentoCatalogInventoryApiStockRegistryInterface');
// add logging capability
$writer = new ZendLogWriterStream(BP . '/var/log/import-update.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
.....
.....
.....
magento2 cron permissions script file-permissions
add a comment |
I have made a few external php scripts to update quantity and tracking numbers,etc Right now, i'm putting them in magento root and set the permission to 640. However, it's still accessible by the browser. I would like to make it accessible by cron and the owner/group only.
I tried to move the script to
magentoroot/script/
, and change the following in the script:
$file = fopen('../../qty.csv', 'r', '"');
require DIR . '../app/bootstrap.php';
$writer = new ZendLogWriterStream(BP .
'../var/log/import-update.log');
then the script stop working. what should i change in the file?
<?php $file = fopen('../qty.csv', 'r', '"'); // set path to the CSV file
if ($file !== false) {
require __DIR__ . '/app/bootstrap.php';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('adminhtml');
// used for updating product info
$productRepository = $objectManager->get('MagentoCatalogModelProductRepository');
// used for updating product stock
$stockRegistry = $objectManager->get('MagentoCatalogInventoryApiStockRegistryInterface');
// add logging capability
$writer = new ZendLogWriterStream(BP . '/var/log/import-update.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
.....
.....
.....
magento2 cron permissions script file-permissions
I have made a few external php scripts to update quantity and tracking numbers,etc Right now, i'm putting them in magento root and set the permission to 640. However, it's still accessible by the browser. I would like to make it accessible by cron and the owner/group only.
I tried to move the script to
magentoroot/script/
, and change the following in the script:
$file = fopen('../../qty.csv', 'r', '"');
require DIR . '../app/bootstrap.php';
$writer = new ZendLogWriterStream(BP .
'../var/log/import-update.log');
then the script stop working. what should i change in the file?
<?php $file = fopen('../qty.csv', 'r', '"'); // set path to the CSV file
if ($file !== false) {
require __DIR__ . '/app/bootstrap.php';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('adminhtml');
// used for updating product info
$productRepository = $objectManager->get('MagentoCatalogModelProductRepository');
// used for updating product stock
$stockRegistry = $objectManager->get('MagentoCatalogInventoryApiStockRegistryInterface');
// add logging capability
$writer = new ZendLogWriterStream(BP . '/var/log/import-update.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
.....
.....
.....
magento2 cron permissions script file-permissions
magento2 cron permissions script file-permissions
edited 3 mins ago
Kris Wen
asked 2 hours ago
Kris WenKris Wen
1589
1589
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270717%2fhow-to-run-external-script-outside-of-magento-2-root-directory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270717%2fhow-to-run-external-script-outside-of-magento-2-root-directory%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown