Title: Unable activate plugin
Last modified: August 31, 2016

---

# Unable activate plugin

 *  Resolved [vladurash](https://wordpress.org/support/users/vladurash/)
 * (@vladurash)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/)
 * I’m unable to activate plugin. I receive following error:
 * Parse error: syntax error, unexpected T_FUNCTION in cronjob-scheduler/cronjob-
   scheduler.php on line 411
 * I have PHP 5.2.17, if this help.
    On my pc this plugin is awesome, but here I
   have PHP 5.6. I think I have to convert this code to PHP5.2 compatibility:
 *     ```
       public function get_schedules () {
   
               $schedules = wp_get_schedules();
   
               uasort($schedules, function ($a, $b) {
   
                   // if schedules are the same return 0
                   if($a['interval'] == $b['interval']) return 0;
   
                   // return comparison int
                   return $a['interval'] < $b['interval'] ? -1 : 1;
               });
   
               return $schedules;
           }
       ```
   
 * Please help

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [jfan2006](https://wordpress.org/support/users/jfan2006/)
 * (@jfan2006)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221173)
 * I have the same error:
 * Plugin could not be activated because it triggered a fatal error.
 * Parse error: syntax error, unexpected ‘[‘ in …/wp-content/plugins/cronjob-scheduler/
   cronjob-scheduler.php on line 700
 *  Plugin Author [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * (@chrispage1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221178)
 * Hi [@jfan2006](https://wordpress.org/support/users/jfan2006/) – please try downloading
   the latest version (1.17) that I have just released to fix this issue.
 * [@vladurash](https://wordpress.org/support/users/vladurash/) – thanks for the
   report. I cannot see why you are getting this error but I will look into it and
   see what I can find.
 *  Plugin Author [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * (@chrispage1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221182)
 * [@vladurash](https://wordpress.org/support/users/vladurash/) I have deployed 
   version 1.18 which should fix your activation issue – it was because PHP 5.2.17
   doesn’t support anonymous functions within uasort.
 * Please let me know how you get on!
 * Chris.
 *  Thread Starter [vladurash](https://wordpress.org/support/users/vladurash/)
 * (@vladurash)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221184)
 * [@chrispage1](https://wordpress.org/support/users/chrispage1/) activation is 
   ok.
 * But now I can’t see anything in Settings>Cronjob Scheduler. No info about wp-
   config or anything else. Please check
 *  Plugin Author [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * (@chrispage1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221207)
 * [@vladurash](https://wordpress.org/support/users/vladurash/) – would you be able
   to get a screenshot of the whole section for me please?
 * Thanks,
    Chris.
 *  Plugin Author [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * (@chrispage1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221209)
 * [@vladurash](https://wordpress.org/support/users/vladurash/) sorry about that.
   It seems version 1.18 refactoring introduced a bug which has since been resolved
   in version 1.19 – please download and update and let me know how you get on.
 * Chris.
 *  Thread Starter [vladurash](https://wordpress.org/support/users/vladurash/)
 * (@vladurash)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221210)
 * I made some test playing with PHP versions on my test website (dev, not prod).
   
   So, on PHP ver 5.2.17, my dashboard looks like this: [https://onedrive.live.com/redir?resid=15AD985AD8F96418!100735&authkey=!AM_sjTawQ21Bj2I&v=3&ithint=photo%2cpng](https://onedrive.live.com/redir?resid=15AD985AD8F96418!100735&authkey=!AM_sjTawQ21Bj2I&v=3&ithint=photo%2cpng)
 * Using higer version for PHP (eg 5.3), it works ([https://onedrive.live.com/redir?resid=15AD985AD8F96418!100736&authkey=!ABtHcdRutjWGcfg&v=3&ithint=photo%2cpng](https://onedrive.live.com/redir?resid=15AD985AD8F96418!100736&authkey=!ABtHcdRutjWGcfg&v=3&ithint=photo%2cpng))
 * Unfortunatelly, on prod website I don’t have access to cPanel to change PHP version(
   owner won’t make this change).
 *  Thread Starter [vladurash](https://wordpress.org/support/users/vladurash/)
 * (@vladurash)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221211)
 * I have also updated plugin to version 1.19 as you instructed. No changes for 
   PHP ver 5.2.17
 *  Plugin Author [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * (@chrispage1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221213)
 * Please can you enable WordPress WP_DEBUG ([https://codex.wordpress.org/WP_DEBUG](https://codex.wordpress.org/WP_DEBUG))
 * Also, is there anything in your error_log files?
 * Unfortunately I am unable to replicate the issue at the minute so need all the
   information I can get.
 *  Thread Starter [vladurash](https://wordpress.org/support/users/vladurash/)
 * (@vladurash)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221214)
 * I don’t have any error_log on server.
 * With DEBUB enabled I have following lines in Setting>Cronjob Scheduler
 *  `Notice: date_default_timezone_set() [function.date-default-timezone-set]: Timezone
   ID ” is invalid in /home/serpante/public_html/wp-content/plugins/cronjob-scheduler/
   cronjob-scheduler.php on line 15
 * Notice: Use of undefined constant __DIR__ – assumed ‘__DIR__’ in /home/serpante/
   public_html/wp-content/plugins/cronjob-scheduler/cronjob-scheduler.php on line
   328
 * Notice: Use of undefined constant __DIR__ – assumed ‘__DIR__’ in /home/serpante/
   public_html/wp-content/plugins/cronjob-scheduler/cronjob-scheduler.php on line
   181
 * Notice: Use of undefined constant __DIR__ – assumed ‘__DIR__’ in /home/serpante/
   public_html/wp-content/plugins/cronjob-scheduler/cronjob-scheduler.php on line
   188
 * Warning: require_once(__DIR__/views/admin_page.php) [function.require-once]: 
   failed to open stream: No such file or directory in /home/serpante/public_html/
   wp-content/plugins/cronjob-scheduler/cronjob-scheduler.php on line 188
 * Fatal error: require_once() [function.require]: Failed opening required ‘__DIR__/
   views/admin_page.php’ (include_path=’.:/opt/alt/php52/usr/share/pear:/opt/alt/
   php52/usr/share/php’) in /home/serpante/public_html/wp-content/plugins/cronjob-
   scheduler/cronjob-scheduler.php on line 188`
 *  Plugin Author [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * (@chrispage1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221215)
 * Okay thank you that helps me a lot. Of course it is the __DIR__ magic constant
   which doesn’t exist in PHP 5.2! Please could you update your file under wp-content/
   plugins/cronjob-scheduler/cronjob-scheduler.php with the contents from the following
   pastebin – [http://pastebin.com/XX03wwjn](http://pastebin.com/XX03wwjn)
 * This will update you to version 1.20. If everything runs smoothly then I will
   roll out support for PHP 5.2
 * All the best,
    Chris.
 *  Thread Starter [vladurash](https://wordpress.org/support/users/vladurash/)
 * (@vladurash)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221216)
 * Well, googleing these errors, i found some fix
 * You have to replace **__DIR__** with **dirname(__FILE__)** on lines 328, 188 
   and 181 in file **cronjob-scheduler.php**
 * Please check this and confirm it 🙂
 * Later edit: we had same opinion 😀
 *  Thread Starter [vladurash](https://wordpress.org/support/users/vladurash/)
 * (@vladurash)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221218)
 * WORKS Perfect! Thanks alot!
 *  Plugin Author [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * (@chrispage1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221219)
 * Great, pleased we got it sorted in the end! I have deployed this now as an official
   version. If you have any other issues, please create a new support request – 
   I will mark this one as resolved! If you like the plugin and support provided,
   please review it 🙂 Reviews and donations help to keep the project going!
 * [@jfan2006](https://wordpress.org/support/users/jfan2006/) it should be all working
   for you now although if you still have issues then please create a new support
   thread I’ll be happy to help!

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Unable activate plugin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cronjob-scheduler.svg)
 * [Cronjob Scheduler](https://wordpress.org/plugins/cronjob-scheduler/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cronjob-scheduler/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cronjob-scheduler/)
 * [Active Topics](https://wordpress.org/support/plugin/cronjob-scheduler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cronjob-scheduler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cronjob-scheduler/reviews/)

## Tags

 * [unexpected T_function](https://wordpress.org/support/topic-tag/unexpected-t_function/)

 * 14 replies
 * 3 participants
 * Last reply from: [chrispage1](https://wordpress.org/support/users/chrispage1/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/unable-activate-plugin/#post-7221219)
 * Status: resolved