PDA

View Full Version : PHP script to start the running of another php script.


sir pannels
01-13-2003, 07:16 PM
yo :)
errr im not sure if this is possible - id imagen so as it is in C and PERL, so does anyone know the code to run another php file from php code.
like start.php has code in it that starts the runnig off workin.php or whatever?
cheers
-P-:thumbsup:

whisk
01-13-2003, 09:51 PM
you could just include the php file you want run and rename is as an .inc for clarity.. cause that is really what you want.


if (something)
include "myfile1.inc";
exit; // if you don't want the rest of this file executed.
else
include "myfile2.inc";

sir pannels
01-13-2003, 11:39 PM
hey,
thanks .. but no thats not what im after. i can include files ok.. but it want it to open in a completly new window , ya know?
cheers anyway Whisk :thumbsup:

Kiwi
01-14-2003, 10:29 AM
header("Location: http://www.domain.tld/newpage.php");It has to be the first thing you send to the page, but that's easy enough to build in (you should always put your logic before you do any presenationation anyway).

Dylan Leblanc
01-14-2003, 10:55 AM
Note that the above code should read:


header("Location: http://www.domain.tld/newpage.php");


Its a forum bug.



Or if you want to open in a new window, you will have to use something other then PHP.

brothercake
01-14-2003, 12:21 PM
.. because PHP is on the server, and has no concept of windows

firepages
01-14-2003, 01:56 PM
you mean like a shell script that does not interact with the user ?

If you cant use CRON for any reason , you can always just exec() your script ..\

exec('path/to/php.exe');

if that 'hangs' your script whilt its running try popen()'ing it.

$yaks=popen('/path/to/script.php');pclose($yaks);

that will run the script as s seperate process.. a lot depends on what your script actually does .. any insights ?