Hi all.
I need to launch a php update script
from within another one (main)
but I need the main.php not to stop waiting for the update.php to finish its task,
so I can't use "INCLUDE" command.
Any suggestion?
Paolo
How to launch a php from inside another, not waiting for it
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: How to launch a php from inside another, not waiting for
It depends upon what you need from the script and what platform you're on. On *nix using exec('/path/to/php /path/to/file/file.php &') should launch it in the background. If you need the output or errors then redirect stdout and stderr to a log file. Or you can use popen(). If you're on windows you can use popen('start c:\path\to\php.exe c:\path\to\file.php') I think.
Another alternative would be to add this as a 'job' to a database table and then have either cron or task scheduler check the database every minute or hour or whatever and if there is a job run the PHP script.
Another alternative would be to add this as a 'job' to a database table and then have either cron or task scheduler check the database every minute or hour or whatever and if there is a job run the PHP script.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.