Search code examples
phpwordpressplesk

Plesk daily print string inside error log file


I'm trying to print, dayli at 12:00, a string "Php Error printed from PLESK" inside error log file, but this don't work.

To daily run the php file i went to domain > SiteName > Schedule Tasks Added a new task, checked "Run a PHP script", selected the path file, selected the schedule time "Daily 12:00" (tryied 11:15, 11:20, 11,25), Description as "My script", Notify "Do not notify" and saved. On Plesk, on scheduled task for mysite.com page, if i press run now button, plesk say "Task "path file" successfully completed in 0 second, output: "Php Error printed from PLESK". So seems that work. But when i open the site error_log file, there isn't the string..........

The code inside php script is:

<?php 
    error_log('Php Error printed from PLESK');
?>

Why i don't see the print inside error_log file?


Solution

  • are you sure you have defined the log file when 'Php Error printed from PLESK' gonna be printed , perhaps it is not declared in the actual file you have added the error_log

    Maybe you need to check https://secure.php.net/manual/en/function.error-log.php

    you can do something like

    error_log("Your Message", 3, "log_file_path");