20

I am trying to enable Developer Mode on a site using Magento 1.7. So far I've added :

SetEnv MAGE_IS_DEVELOPER_MODE "true"

to the .htaccess file and :

...
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
}
...

to the index.php file as described here. I have even removed the If clause, leaving only :

...
    Mage::setIsDeveloperMode(true);
...

in the index.php file. But still no luck. What am I missing? What should I do in order to enable Developer Mode?

  • 1
    Both of your methods should work. What do you mean by "still no luck"? What happens that makes you say it doesn't work? – Marius Feb 21 '14 at 6:33
26

Try the following in your index.php file:

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
    ini_set(’display_errors’, 1);
}

Also make sure to double check that you have:

1. Disable Cache System > Cache Management > Select All [check-boxes] > Actions = Disable > Submit

2. Re-Index All System > Index Management > Select All [check-boxes] > Actions = Reindex Data > Submit

3. Disable Compilation System > Tools > Compilation > Disable

Note: By default compilation mode is disabled. So just check if the Compiler Status is Enabled or not.

4. Turn on Logging System > Configuration > Advanced > Developer > Log Settings > Enabled => Yes

  • Mage::setIsDeveloperMode(true); was the ticket. Cheers. – Darth Egregious Nov 7 '14 at 21:12
  • i do any thing when enable ini_set(’display_errors’, 1); its work – Saeed Darvish Aug 15 '16 at 5:48
9

Three possible things to check

  1. You're editing the wrong index.php/.htaccess file

  2. You have other custom code in the system that's turning developer mode off

  3. Your expectations of what developer does are incorrect (Describing you expectation mismatch may help people debug your problem)

  • Thanks Alan! 1. The files Im editing are located in the Document Root. 2. The system is a fresh install of Magento so that should not be an issue. 3. Im expecting errors to pop up in the browser window instead of a white empty page, which I am getting atm. Are my expectations a bit off? – fuumind Feb 21 '14 at 8:48
  • What's the display_errors php ini value? What's in the web server's error logs? – Alan Storm Feb 21 '14 at 22:16
  • The web servers error logs is (of course) the place to look! Thanks for pointing that out! :) Are errors ever presented on a web page that has failed to render or does Magento fail silently by design? – fuumind Feb 23 '14 at 20:02
1

Try the following in your index.php file: Move Mage::setIsDeveloperMode(true); from If condition.


if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
    ini_set(’display_errors’, 1);
}

TO

Mage::setIsDeveloperMode(true); if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) { ini_set(’display_errors’, 1); }

0

It can be due to server redirection also.

Please check phpinfo output and check $_SERVER['REDIRECT_MAGE_IS_DEVELOPER_MODE'] variable also.

Explanation :

If You are working with the Apache module mod_rewrite and want to set some environment vars, the Apache manual says these vars could be accessed in CGI using $ENV{VAR}. In PHP You might want to write $_ENV['VAR'] to get the value of VAR, but You have to access if via $_SERVER, and in some different ways :

  1. Example: .htaccess and example.php

RewriteEngine on RewriteRule ^?var1=([^;]);var2=([^;])$ \ - [E=VAR1:$1,E=VAR2:$2]

  1. Example: .htaccess and index.php

RewriteEngine on RewriteRule ^index.php$ - [L] RewriteRule ?var1=([^;]);var2=([^;])$ \ index.php [E=VAR1:$1,E=VAR2:$2]

Note: If any RewriteRule matches, an internal redirect than restarts (after the last defined rule, or immediately after the matched rule having a L-flag) checking the entire rule set again. For an internal redirect, every defined VAR gets an 'REDIRECT_' prefix, i.e. VAR1 will be REDIRECT_VAR1, VAR2 will be REDIRECT_VAR2.

Of course, You can (additionally) redefine the original VAR:

RewriteEngine on RewriteRule ^index.php$ \ - [E=VAR1:%{REDIRECT_VAR1},E=VAR2:%{REDIRECT_VAR2},L] RewriteRule ?var1=([^;]);var2=([^;])$ \ index.php [E=VAR1:$1,E=VAR2:$2]

With this, You will have $_SERVER['REDIRECT_VAR*'] and $_SERVER['VAR*'].


The given examples are only for explanation, in any case, they are not intended to fit Your needs. The "\" in the .htaccess examples are only for display purpose, they should not occur in a real .htaccess file. The argument separator ';' in links can also be '&', but this may cause some trouble with HTML/XHTML. See the following pages for more information about this issue:

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.