Write to a txt file when running a php from cmd

0

I have a file php which has to be executed once a month with this no problem and a txt in which I record the events and errors occurred if I execute it in the browser everything perfect but when you run the file php with cmd this does not record anything , any suggestions.

php function to write in the txt

function write_log($cadena,$tipo){
    $file = fopen("a08e2d073704db3ea107e3bbd81a8af1.txt", "a+");
    fwrite($file," [ ".date("d-m-Y H:i:s")." - $tipo ] ".$cadena . PHP_EOL);
    fclose($file);
}

EDITO

When calling from the .bat file, it does not perform as expected

.bat file

cd C:\xampp\php & php C:\xampp\htdocs\bienestar\adminb20185488dd94bdb4cc1b7c56494c1a.php
    
asked by Kevin 01.02.2018 в 20:44
source

0 answers