Mage registry key "controller" already exists - php

I have configured an ecommerce site using Magento, but it is throwing an error.
Mage registry key "controller" already exists
I am not sure what to do. The URL for site is http://musicademy.sweetersinging.com/store/admin

This usually happens if you try and run Mage::run() twice - or specifically, once more after the index.php bootstrap.
Sounds like a (extremely) badly written 3rd party extension or template. It (sadly) wouldn't be the first time I've seen someone execute this within a .phtml file.
Go through the standard debug process, refresh between each.
Move app/code/local to app/code/local.bak
Move app/code/community to app/code/community.bak
Move app/design/frontend/your_custom_package to app/design/frontend/your_custom_package.bak
Once you've found the cause above, then you can start to filter through the filters/dirs to check.

If you have Magefirewall extension installed try disabling at the webserver(by going to magento_root_dir/app/etc/modules/magefirewall.xml) and clear the cache (by deleting all the files/folders in magento_root_dir/var/cache/) if you don't have access to the admin panel. Doing this solved the issue for me on Magento CE 1.9.2.2.

Related

TYPO3, realurl not working after change the domain

We have an old TYPO3 site (v4.7) and we moved the site to another domain.
now all the pages give the error: 404 Not Found
when I tried to get the page using URLs containing page id like /index.php?id=2, it works
how can I fix the site to works using real spoken URL /page-name
thanks
First of all you should change the domain record (in the backend, at the root of the domain in "List" view).
Maybe the domain is hard-coded in your realurl-config which is usually at /typo3conf/realurl* (realurl-extension configuration in the extension manager). If you selected "auto-configuration" in realurl's extension configuration and nobody made the mistake to make changes to the file directly, you can delete it and let it regenerate.
Maybe TypoScript settings like config.baseURL or config.absRefPrefix have a say here, too. I suggest to check in the template analyzer (backend: "Template" -> select your domain's root -> template analyzer -> view complete listing) if there is something with the old domain.
Of course, realurl needs to be activated (TypoScript config.tx_realurl_enable = 1) but if you did not change it, that should not have changed.
Then of course clear all caches (preferably via the function in the Install Tool).
If you still have problems, deleting /typo3temp (and recreating it via the InstallTool) might help. And check if there's something useful in the logs, of course (where, depends on ['SYS']['systemLog'] and ['SYS']['systemLogLevel'], probably typo3temp/*.log or your PHP error log).
Good luck with that ole' T3 ;)

How to move Joomla's configuration.php file above the root folder in a web host?

I have installed a security solution in my Joomla website,and it's suggest that to put the configuration.php file above the Public_html Folder,how could it be possible?
how to tell the CMS to recognize the new location?
is the solution would be valid in all versions of the Joomla CMS? ,if it's not,so please
write:
1st:Joomla 2.5 Solution.
2nd:Joomla 3 Solution.
you would need to modify the defines.php file located in the includes folder.
Specifically this line:
define('JPATH_CONFIGURATION', JPATH_ROOT);
And change JPATH_ROOT to the correct path.
But the problem with this is that you are modifying a core file so if an update changes the defines.php file it will overwrite your changes and will break your setup. You will need to reedit the file.
Also the JPATH_CONFIGURATION constant may be used for other things within the CMS that are not specifically trying to get the configuration.php file so make sure to check that it will not adversely affect other parts of the cms before doing this in production.
Alternatively you can change the frameworks.php file (also in the includes folder) directly to change from where the configuration is loaded from
ob_start();
require_once JPATH_CONFIGURATION . '/configuration.php';
ob_end_clean();
Just change the require_once line to the correct path.
Again since this is a core file it could be changed by an update. But this may also affect other parts if the config file is loaded manually in components or other parts of the cms.
Simply answer is don't do it. This would mean you would have to do what #Patrick has suggest which is correct and will work, however it means editing a core Joomla file. This is not a good idea as in your case, if you ever update Joomla, you will have to perform this change every time and it you forget (which is likely), your site will stop working completely.
I would strongly suggest you find a different "security solution" which does not involve having to modify any core Joomla files.
If you could define what you mean by "security solution", then maybe an alternative could be provided for you
I didn't dig for 'since when this has been implemented', But it can be done without changing the core.
Joomla looks for a defines.php in the root and if its present, imports it. And then if it finds a constant named _JDEFINES defined, it doesn't load the original file, effectively overriding it completely.
So, If you wish to override the defines its pretty easy and all you have to do is copy the contents of the defines.php file from under the webroot/includes/ path and paste it inside the one we created in the webroot. And you can change the following constant as per your taste.
define('JPATH_CONFIGURATION', JPATH_ROOT."/my/supersecret/directory");
Now there is one more thing left to be done and then we are good to go :)
You have to prepend the following lines to the top of our override file (the defines.php in the webroot).
define('JPATH_BASE', __DIR__);
define('_JDEFINES', 1);
This constant conveys to the framework that the defines have been overridden and to use the new file accordingly (Last time I checked, this flag/constant is checked at around 10 different places all over the framework eg. here, so its important)
Also I have seen this feature available with Joomla v2.5.0 and v3.8.8 as per your requirements in the question.
Edit: Remember you have to repeat the same procedure for administrator folder too if you want admin panel to work, and remember that administrator has its own /includes/defines.php

Restler 3.0 RC5 HtmlFormat uses mkdir

first thanks for your brilliant work on Restler, I am using it for some labs at the University and so far it works like a charm, really simple and elegant framework!
I've been using Restler 3.0 RC4 successfully until I updated to RC5 today. Now I'm having problems with the HtmlFormat. Whenever I try to access any of my web services that return HtmlFormat or try to enter the API Explorer, I'm getting a HTTP 500, "Unable to create cache directory /home/xxxxxxx/public_html/concrete/api/cache/php" . Also, I see a "Warning: mkdir() [function.mkdir]: No such file or directory in /home/xxxxxxx/public_html/concrete/Restler/vendor/Luracast/Restler/Format/HtmlFormat.php on line 367" .
Do you have any idea of what could be happening? In the upgrade, I just replaced my Restler framework folder with the RC5 one, without any changes in my API itself.
I would appreciate any help. Thank you!
Most of the template formats need a cache folder to keep their compiled files so that they run efficiently
Since RC5 we create a subfolder for the template type used. Even though php templates does not need compilation Restler attempts creating php folder under the default cache location, which is cache folder located in the same folder as the index.php
In your case it is
/home/xxxxxxx/public_html/concrete/api/cache
You should update the cache folder to keep it outside the web root by adding
Defaults::$cacheDirectory = '/home/xxxxxxx/cache';
And then make sure the cache folder is writable
Then HtmlFormat will create the php/twig/blade folder depending on your template preference and add the compiled files inside

Joomla administrator redirects to installation

I have a Joomla 2.5 site were I can no longer access the administrator panel. That only redirects me to /installation/index.php which (as it should) gives a 404. I think this happened after an upgrade.
I tried to clear browser cache as suggested here: Joomla 1.0, administrator link redirect to "installation/index.php", how to prevent this redirection?
But that didn't work.
A long time ago, back in the 1.x days, there were some security advices on the Joomla site which among other things suggested to move configuration.php outside the public_html directory which I followed. I can't find them now, but I tried to copy the configuration.php file to Joomla root directory as well as keeping it at the directory which is defined in defines.php (define('JPATH_CONFIGURATION').
Any ideas?
My extensions
bash-3.2$ find plugins/ -type d
plugins/
plugins/authentication
plugins/authentication/gmail
plugins/authentication/joomla
plugins/authentication/ldap
plugins/captcha
plugins/captcha/recaptcha
plugins/content
plugins/content/emailcloak
plugins/content/finder
plugins/content/geshi
plugins/content/geshi/geshi
plugins/content/geshi/geshi/geshi
plugins/content/joomla
plugins/content/loadmodule
plugins/content/pagebreak
plugins/content/pagenavigation
plugins/content/vote
plugins/editors-xtd
plugins/editors-xtd/article
plugins/editors-xtd/image
plugins/editors-xtd/pagebreak
plugins/editors-xtd/readmore
plugins/editors
plugins/editors/codemirror
plugins/editors/none
plugins/editors/tinymce
plugins/extension
plugins/extension/joomla
plugins/finder
plugins/finder/categories
plugins/finder/contacts
plugins/finder/content
plugins/finder/newsfeeds
plugins/finder/weblinks
plugins/quickicon
plugins/quickicon/extensionupdate
plugins/quickicon/joomlaupdate
plugins/search
plugins/search/categories
plugins/search/contacts
plugins/search/content
plugins/search/newsfeeds
plugins/search/weblinks
plugins/system
plugins/system/cache
plugins/system/debug
plugins/system/highlight
plugins/system/languagecode
plugins/system/languagecode/language
plugins/system/languagecode/language/en-GB
plugins/system/languagefilter
plugins/system/log
plugins/system/logout
plugins/system/p3p
plugins/system/redirect
plugins/system/remember
plugins/system/sef
plugins/user
plugins/user/contactcreator
plugins/user/joomla
plugins/user/profile
plugins/user/profile/fields
plugins/user/profile/profiles
Try this, if wont work move to another point.
1. Change this
if (file_exists(JPATH_INSTALLATION.'/index.php')) {
header('Location: '.substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php')).'installation/index.php');
To this:
if (file_exists(JPATH_INSTALLATION.'/index.php')) {
header('Location: '.substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php')).JPATH_INSTALLATION.'/index.php');
Its line 25-26 in administrator/includes/framework.php
2. Remove line 23-32 in this file - it checks for installation folder and size of configuration file, if you dont have installation folder and configuration file is ok, you can remove this
3. set variables $sef and $sef_rewrite to zero in configuration.php
Diagnosing The Situation
Perhaps you should start with diagnosing the plugins? By removing them all and adding in one by one to see what one causes an issue. As you recently updated, a plugin perhaps is causing this issue as it is outdated and is creating conflictions between the software and the extension.
The issue may be based around that the configuration cannot be found, so Joomla presumes you have not installed the software.
Have you done all of these?
Removed installation folder
Checked if .htaccess isn't causing the issue
Attempt a downgrade and upgrade?
I think plugins would not cause redirecting to installation folder. Most likely the system thinks it's not installed yet, which would most likely be caused due to a missing configuration.php file in a location where Joomla expects it to be.
You can try to add something like this to the end of defines.php:
var_dump(file_exists(JPATH_CONFIGURATION.DS.'configuration.php'));
If it outputs true - that means config file exists and the problem is not in it.
Then I would rename .htaccess to htaccess.txt to make sure it has no effect.
If that doesn't work you could also lookup index.php file in public_html folder and make sure no changes have been made to it.
I'm pretty sure config file is not in its location and this should resolve your issue. Hit me back if it doesn't and I will help you further.
Try this things
Delete the joomla installation file directory: c:/host/project path/your site/installation
Check your server and restart it
Be ensure the required services are available on the server
Try installing the new Joomla package http://www.joomla.org/download.html
Thanks
IMHO you need to delete the /installation folder after an installation. Otherwise if it finds this folder and you get redirected there.
For security reasons Joomla does not allow you to be redirected to your site front-end or back-end before you delete the installation folder after the installation is complete.Please make sure the joomla /installation folder is deleted, and if yes, restart your server if possible.

Can I customize the Magento app/code/core folder without affecting future upgrades?

I found a guide on how to add new attributes to users, it explains that for this operation I must modify some files in the app / code / core / Mage directory (the directory that contains Magento’s modules).
But if i make some changes in that folder will this affect future upgrades?
Will an upgrade will delete my changes?
Should I limit the changes only to my modules to not have problems with updates?
You can also make a copy of the file in app/code/local/ with the same directory structure as the file has under app/code/core/. File under local will override those under core and will not be affected by upgrades.
For example:
app/code/local/Mage/Checkout/Block/Onepage/Billing.php
will override:
app/code/core/Mage/Checkout/Block/Onepage/Billing.php
and will not be overwritten by upgrades. Note that this will only work for Block and Model files.
You can also override files through custom modules with the config.xml file, although this is a bit more advanced.
Yes, changes such as these will be overwritten.
If you have such changes, try to:
keep core changes to a minimum
document any changes you make
report the issues on the Magrnto web site so that the changes can be replicated for everyone else
Controllers would work as well if you enable that Module in local space
local vs core controller

Categories