How to run a PHP script even with closed browser

Asked

Viewed 485 times

1

I need a php script to run even with the browser closed. There is this possibility?

I would like some suggestions.

Thank you very much!

  • 1

    Do you have a server? already tried to use cron?

  • Is there a way to use the shell_exec and use the nohup, this way the process will remain active. It seems strange, but the qualquercoisa.php can call outracoisa.php (or himself, but then create a loop) and will not be interrupted by disconnection. If this is ideal is another story. hahaahha

1 answer

1

I use php scripts in the background using linux.

just put

#!/usr/bin/php -q
<?php
// CODIGO PHP

and put your php code.

Then you set up your linux crontab to run your script at specified times and/or days.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.