Reputation: 20322
I have a script from where i try to call another script by using shell_exec()
:
test.php
$webroot = getcwd();
shell_exec("php $webroot/myscript.php");
myscript.php
<?php
echo "hello";
I want myscript.php
to open in a console. Is this possible?
Upvotes: 2
Views: 825
Reputation: 3617
I think what you mean is to run the script in GTK terminal . What you can do is something like this
$webroot = getcwd();
shell_exec("xterm -hold -e 'php $webroot/myscript.php'");
this will pop open a terminal and hold it until the user closes the same. This is for linux only.
Upvotes: 2
Reputation: 403
You can. Your example is working.
You can look output from shell_exec
in test.php:
$webroot = getcwd();
$output = shell_exec("php $webroot/myscript.php");
echo $output;
Upvotes: 0