• Resolved vladurash

    (@vladurash)


    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)
  • 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

    (@chrispage1)

    Hi @jfan2006 – please try downloading the latest version (1.17) that I have just released to fix this issue.

    @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

    (@chrispage1)

    @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

    (@vladurash)

    @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

    (@chrispage1)

    @vladurash – would you be able to get a screenshot of the whole section for me please?

    Thanks,
    Chris.

    Plugin Author chrispage1

    (@chrispage1)

    @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

    (@vladurash)

    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

    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)

    Unfortunatelly, on prod website I don’t have access to cPanel to change PHP version (owner won’t make this change).

    Thread Starter vladurash

    (@vladurash)

    I have also updated plugin to version 1.19 as you instructed. No changes for PHP ver 5.2.17

    Plugin Author chrispage1

    (@chrispage1)

    Please can you enable WordPress WP_DEBUG (https://codex.www.ads-software.com/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

    (@vladurash)

    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

    (@chrispage1)

    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 – https://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

    (@vladurash)

    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

    (@vladurash)

    WORKS Perfect! Thanks alot!

    Plugin Author chrispage1

    (@chrispage1)

    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 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.