Title: PHP script not being executed
Last modified: August 1, 2018

---

# PHP script not being executed

 *  [wigwam1234](https://wordpress.org/support/users/wigwam1234/)
 * (@wigwam1234)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-script-not-being-executed/)
 * 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](https://wordpress.org/support/users/miunosoft/)
 * (@miunosoft)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/php-script-not-being-executed/#post-10550453)
 * 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.

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

 * 1 reply
 * 2 participants
 * Last reply from: [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/php-script-not-being-executed/#post-10550453)
 * Status: not resolved