Sometimes it is needed to urgently disable and clear Magento compiler, e.g. after installation or some 3rd party Magento module.
If you have active Magento compiler, it is always recommended to disable it before any module installation. You can easy to do it in Magento administrator panel, but what if you installed module by mistake, when compiler was active? Most likely your Magento admin panel will be not accessible.
Fortunately there is a way to clear and disable Magento compiler using command shell.
Login to your server via SSH, change directory to [Folder of your Magento]\shell and execute these commands:
php -f compiler.php clear php -f compiler.php disable
Clear Magento cache directory (/var/cache), and try to login to Magento admin panel.
If everything is Ok, you can activate Magento compiler back using System -> Tools -> Compiler page.
If you don't have SSH access to your server, you can do the same actions using exec() PHP function. All you need to create special PHP script, upload it to your server via FTP and execute it in your browser.
Here is an example of commands for such PHP file:
echo exec('./shell/php -f compiler.php clear'); echo exec('./shell/php -f compiler.php disable');
#define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
#define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');
And then, Login Admin Panel and change the Compiler Disable/Enable . :)
the php file is a good trick.. but then , the error is still there:
worse, as i've done my magento in maintenance, i can't access my admin dashboard, the 2 ways are to use FTP and find the right file change to get back in ...OR change any key in database too ;)
i get this error:
1- i put the script here: magento adress/shell/script_PHP_clear compiler2.html
2 - then i get back to downloader ( http://magento adress/downloader/index.php )
3 - ERROR mesage: Fatal error: Class 'Magento_Db_Adapter_Pdo_Mysql' not found in /homepages/44/(server base adress)/magento adress/app/code/core/Mage/Core/Model/Resource.php on line 165
Any idea please, to solve and get back in ? or to re-install ?
problem has appear after i found time too long when, in downloader i use upgrading (about 75% was upgraded right form 1.7.2 to 1.8.0 but some were not, so i do 1 by 1 .. first was google( module..) but checking said about other not right version: also i i go to upgrade those incriminated modules, .. but there it fails, as i get back to precedent page (may be i stop the compiler process ?).
--> no i don't remind which last module it was ?
Even if a little trick to re-life this magento, coz for now it's all closed even for me as admin :(
Could not open input file: compiler.php
[designer@myserver html]$ php-f compiler.php clear
-bash: php-f: command not found
Any idea? Tried both within the subdomain, and subdomain/html
it worked for me