Manually Enable, Disable the Compiler In Magento



Some times we can not access our magento admin and want to disabled the Magento Compiler manually or from the SSH. For getting the more information on the Magento Compiler. It is very easy to Enable or Disabled the Maganto Compiler manually or by using the SSH shell, follow the Methods given below:

Method 1. Enabling The Magento Compiler Manually

Step 1. Navigate to the includes/config.php and uncomment following lines by replacing the # at the beginning of the line

#define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
#define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');

then it will look like as

define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');

Step 2. Navigate to the var/session and delete all the session files of this folder
Step 3. Navigate to the includes/src and delete all the contents of this folder
Step 4. Navigate to the var/cache and delete all the files and content of this folder

Method 2. Disabling The Magento Compiler Manually if it is already Enabled

Step 1. Navigate to the includes/config.php and comment following lines by adding the # at the beginning of the line

define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');

then it will look like as

#define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
#define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');

Step 2. Navigate to the var/session and delete all the session files of this folder
Step 3. Navigate to the includes/src and delete all the contents of this folder
Step 4. Navigate to the var/cache and delete all the files and content of this folder

Method 3. Enabling/Disabling The Magento Compiler By Using The SSH

For working on the SSH it is very Important to Open a command prompt to the root of your store and use the command below:

Step 1. $ cd shell
$ php -f compiler.php help (If PHP is available on the command line.) then it will give all the commands of the compiler like as:

state         Show Compilation State
compile       Run Compilation Process
clear         Disable Compiler include path and Remove compiled files
enable        Enable Compiler include path
disable       Disable Compiler include path
help          This help

Step 2. For Enabling the Compiler you can use the
$ php compiler.php enable
$ php compiler.php compile
Command then it will result Compilation successfully finished.

Step 3. For disabling the Compiler if it is already running use the command below
$ php compiler.php disable

Step 4. After Disabling the Compiler use the below command to delete all the compiled files from the folder
php -f compiler.php — clear

You have done with it enjoy the Magento Compiler Functionality.