Title: register_activation_hook &#8230; again
Last modified: August 19, 2016

---

# register_activation_hook … again

 *  Resolved [chriscb65](https://wordpress.org/support/users/chriscb65/)
 * (@chriscb65)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/register_activation_hook-again/)
 * That’s weird… I must the XXXth to post a question about this damn register_activation_hook.
   My problem is quite strange, the activation hook didn’t trigger if I don’t finish
   my method with and exit() ( and exit() is firing an error…)
 * This code doesn’t work :
 * in file wppc_deck_admin.php
 *     ```
       class wppc_deck_admin {
           public function __construct() {
           }
   
           public function install() {
             global $dfd;
   
             wppcLog($dfd, "Installation du plugins");
             //
             // @mkdir(WPPC_GALLERY_PATH.'cache', 02775, true);
             // @mkdir(WPPC_GALLERY_PATH.'original', 02777, true);
             //
             // chmod(WPPC_GALLERY_PATH.'cache', 02777);
             // chmod(WPPC_GALLERY_PATH.'original', 02777);
             //
             // wppcLog($dfd, "Src : ".WPPC_ABSPATH."medias/default.jpg\nDst : ".WPPC_GALLERY_PATH."original");
             // copy(WPPC_ABSPATH."medias/default.jpg", WPPC_GALLERY_PATH."original/default.jpg");
             //
             // $this->createTables();
           }
         }
       ```
   
 * And this one work but trigger an error (due to the exit)
 *     ```
       public function install() {
             global $dfd;
   
             wppcLog($dfd, "Installation du plugins");
             //
             // @mkdir(WPPC_GALLERY_PATH.'cache', 02775, true);
             // @mkdir(WPPC_GALLERY_PATH.'original', 02777, true);
             //
             // chmod(WPPC_GALLERY_PATH.'cache', 02777);
             // chmod(WPPC_GALLERY_PATH.'original', 02777);
             //
             // wppcLog($dfd, "Src : ".WPPC_ABSPATH."medias/default.jpg\nDst : ".WPPC_GALLERY_PATH."original");
             // copy(WPPC_ABSPATH."medias/default.jpg", WPPC_GALLERY_PATH."original/default.jpg");
             //
             // $this->createTables();
             exit();
           }
       ```
   
 * And here is the register_activation_hook in the main file :
 *     ```
       if (is_admin()) {
   
               require_once(WPPC_ABSPATH."class/wppc_deck.admin.class.php");
               wppcLog($dfd, "Just before activation hook");
   
               $wppcDeck = new wppc_deck_admin();
               register_activation_hook( __FILE__, array(&$wppcDeck, 'install'));
   
       }
       ```
   
 * I really don’t understand what is happening
 * With the second piece of code, the install method is called and with the first
   one, nothing happened ( but the plugins is activated ).
 * I really need helk..

Viewing 1 replies (of 1 total)

 *  Thread Starter [chriscb65](https://wordpress.org/support/users/chriscb65/)
 * (@chriscb65)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/register_activation_hook-again/#post-1317026)
 * I think I’ve found where my problem come from : the responsable is my debug file
   descriptor $dfd (defined in another file)… I think this var is used somewhere
   else in wordpress.

Viewing 1 replies (of 1 total)

The topic ‘register_activation_hook … again’ is closed to new replies.

## Tags

 * [development](https://wordpress.org/support/topic-tag/development/)
 * [register_activation_hook](https://wordpress.org/support/topic-tag/register_activation_hook/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 1 participant
 * Last reply from: [chriscb65](https://wordpress.org/support/users/chriscb65/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/register_activation_hook-again/#post-1317026)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
