• Resolved aldebarantower

    (@aldebarantower)


    I’m testing “RUN PHP SCRIPTS”, but nothing happens.

    I tried with:

    <?php
    unlink(“test.txt”);
    $myfile = fopen(“test.txt”, “w”) or die();
    fwrite($myfile, “INICIANDO” . PHP_EOL);
    fwrite($myfile, “TERMINANDO” . PHP_EOL);
    fclose($myfile);
    ?>

    Log show:

    -Starting a routine.
    –Starting the routine. ID xxx Action: Run PHP Scripts.
    –Still have threads.

    Debug is active on file wp-config.php, but nothing happens on debug.log:

    define(‘WP_DEBUG’, true);
    define(‘WP_DEBUG_LOG’, true);
    define(‘WP_DEBUG_DISPLAY’, true );
    define(‘SCRIPT_DEBUG’, true );

    I’m using WordPress WordPress 5.0.4, with “Twenty Nineteen” theme.

    Waiting for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi,

    Where do you expect the test.txt file to be created?

    I suspect it is created under the WordPress installation root directory where index.php resides. I would test by giving an absolute path instead of just test.txt.

    Thread Starter aldebarantower

    (@aldebarantower)

    i tried two paths, the file did not create.

    <?php
    define(‘ROOTPATH’, __DIR__ . ‘\\’);
    $path = ROOTPATH.’test01.txt’;
    $myfile = fopen($path, “w”);
    fwrite($myfile, “INI*****”.PHP_EOL);
    fwrite($myfile, “FIN*****”.PHP_EOL);
    fclose($myfile);
    ?>

    <?php
    define(‘ROOTPATH’,dirname(__FILE__) . ‘\\’);
    $path = ROOTPATH.’test01.txt’;
    $myfile = fopen($path, “w”);
    fwrite($myfile, “INI*****”.PHP_EOL);
    fwrite($myfile, “FIN*****”.PHP_EOL);
    fclose($myfile);
    ?>

    the code run successful on my local IIS (php only, no wordpress, no plugin), but nothing happens when Task Scheduler plugin execute the script (server on production).

    Thread Starter aldebarantower

    (@aldebarantower)

    I created a new WordPress installation, now task scheduler run php script.

    I do not know what happen.

    I am sorry for generate the topic.

    Plugin Author miunosoft

    (@miunosoft)

    Not a problem. Glad to hear it works now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Run PHP Scripts – Nothing happens’ is closed to new replies.