1

Basically I have only the admin credentials of the client site and the site is in production mode. The client only provides admin credentials. How to enable path hints?

2

You can not add the IP restriction for the template path hints from the terminal or admin configuration if the production mode is enabled.

However, you can do it with the help of the below MySQL query execution.

UPDATE `core_config_data` SET `value` = '1.1.1.1' WHERE `core_config_data`.`path` = 'dev/restrict/allow_ips'; //where 1.1.1.1 is ip address, you can give multiple IPs here with the comma seperated

After adding the IP addresses, you need to run the below commands from the terminal to enable the template path hints for your website.

php bin/magento dev:template-hints:enable
php bin/magento c:f

Edit:

Execute the below script for updating the core_config_data table entry for allowed IP address.

<?php

    use Magento\Framework\App\Bootstrap;
    use Magento\Sales\Model\Order;

    require __DIR__ . '/app/bootstrap.php';

    $bootstrap = Bootstrap::create(BP, $_SERVER);

    $objectManager = $bootstrap->getObjectManager();

    $state = $objectManager->get('Magento\Framework\App\State');
    $state->setAreaCode('frontend');

    $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
    $connection = $resource->getConnection();
    $tableName = $resource->getTableName('core_config_data');

    // UPDATE DATA
    $path = 'dev/restrict/allow_ips';
    $sql = "UPDATE " . $tableName . " SET value = '1.1.1.1' WHERE path = " . $path;
    $connection->query($sql);

Hope it helps!!!

  • what is in the scenario of when we have only the admin credentials .i have not the database credentials and local setup of site.Only i have admin panel credentials. – usman Oct 11 at 6:47
  • Okay, in that case, you can run the script to update the core_config_data table with your IP address. I've added the script in my answer for the same. – Sumit Oct 11 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.