1
I am running the following code on the Linux Server via Digital Ocean’s Putty
Inside the Crontab-e
This way
01 00 * * * /var/www/html/atualizador/atualizador-global.php
* * * * * /usr/bin/php7.3 http://www.sistemasjca.com.br/atualizador/cronteste.php
mailto="[email protected]"
However the PHP code does not run inside this cronteste.php file I am running a code to insert a line in the database, but I have no return, when I look at the database has not been inserted and also I do not receive email about the execution.
I also tried to run like this
* * * * * /usr/local/bin/php /var/www/html/atualizador/atualizador-global.php
The test code I’m trying to run is the following.
require_once("conexao-com-banco-users.php");
testaCron($conecta_login);
function testaCron($conecta){
$query_bancos = "INSERT INTO banco_usuarios.tbl_usuarios(funcionario, usuario, email, senha, imagem) VALUES('CronjobUser','CronjobUser','CronjobUser','CronjobUser', '8D')";
$resultado = mysqli_query($conecta, $query_bancos);
if($resultado)
echo 'usuario inserido com sucesso';
}
?>
This is the log I was pulled via "grep CRON /var/log/syslog"
Want PHP to access a remote page?
– Guilherme Nascimento
do not want to run a php code on the server side without involving the front end this code basically inserts a data into the database
– Andrews Gomes
But the execution of your command is like this, so I asked. It has nothing to do with front-end, actually line command or interact with the browser, unless you want, but there is "another 500", if you want the page to process is WGET, if the script is on the same server and failed is pq there is something wrong with the script, probably.
– Guilherme Nascimento