Failed to set the php scheduled task with SQL insertion in ubuntu?

set scheduled tasks on ubuntu18.04 and execute the PHP file ds.php . Contents of PHP file:

<?php
    file_put_contents(__DIR__."/ds.txt",date("Y-m-d H:i:s"));
    $mysqli = new mysqli("127.0.0.1","root","123456","mydb");

    if($mysqli->connect_errno){
        die("(".$mysqli->connect_errno.")".$mysqli->connect_error);
    }
    
    $sql = "insert into uinfo(uname,age,sex,phone,email,addr,create_date) values("",25,1,"13195437098","zhangsan@qq.com","","".date("Y-m-d H:i:s")."")";

    $mysqli->query($sql);

this code can be executed correctly by using php / var/www/ds.php directly.
scheduled task code:

*/1 * * * * php /var/www/ds.php

but only the line of file_put_contents will be executed, and the content will be written to the file. But the later code that executes SQL inserts the data will not be executed. Then the log file shows:

clipboard.png

after I installed postfix, I didn"t report this error, but I still didn"t perform the SQL insert operation. Excuse me, did I write something wrong? Or is it misconfigured?

Apr.07,2021

I have an error here, that is, an error will be reported during the execution of this timing file using php. There is no problem with using curl. That is, when postfix is installed, modify the contents of the timing file to
* / 1 * curl http://localhost/ds.php

Menu