• Hi,

    I’ve got a PHP file that when I call directly from the URL works as expected. It is a fairly simple file, it just creates some JSON and saves it to the file system.

    I’ve created a task in the Task Scheduler, told it to run my script and set it to run at midnight each day. At the end of the file running I am sending an email to confirm that the task ran. I am never receiving this email, and the JSON is never changing.

    The overview page shows my task, and the last run column is incrementing daily, so it thinks that it has run. There is an exit code of 1, which if memory serves means success.

    Any ideas what could be going wrong here?

    Thanks,

    Tony

Viewing 1 replies (of 1 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi,

    I do not know. Sounds like your PHP script is not finished.

    The plugin merely includes the PHP file using include(), not using exec() or shell() so it is possible to have class/function/variable(global) name conflicts.

    You should check PHP error log. In wp-config.php by default, you have a line define( 'WP_DEBUG', false );. If you haven’t modified it, temporarily change it to

    
    //define( 'WP_DEBUG', false );
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', true );
    define( 'SCRIPT_DEBUG', true );
    

    Then run the task which includes your PHP script. The error log file will be created in the wp-content directory. If you do this, you may get errors by other plugins and the theme. So it is recommended to temporarily disable other plugins and switch to the default theme.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP script not being executed’ is closed to new replies.