Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[b]howto execute a TCL script from with php script[/b]

Status
Not open for further replies.

happyIndian100

Programmer
Jul 20, 2003
66
US
How can i execute a TCL Script from PHP.

and i want to use the Return value of TCL script in PHP.

Please Advise.
 
Didnt Worl", which I assume should be "It didn't work", is very vague.

Did you get an error message?
What diagnostic steps have you taken?
Does your tcl script try to do something that filesystem permissions might be a factor?



Want the best answers? Ask the best questions! TANSTAAFL!
 
sorry for the vague information.
here is what i am doing.

test.tcl
---------
#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}

set result 38

puts $result
return $result
-----------------------------------------------------

myFile.php
---------
<?php
global $res;

$res = exec ("test.tcl") ;
echo $res;
?>

It is not printing any thing when i call myFile.php from browser. I even tried with shell_exec. The page doesnt respond.

when i use,
$res = exec (tchsh "test.tcl") ;

it is not printing any thing.






 
When running a program script through an interpreter from the command line, it is generally necessary to invoke the interpreter and tell it what script to run. For example, if I wanted to run a php script from the command line, I would like have to do something like:

php foo.php


Likewise, from within your PHP script you invoke invoke the tcl interpreter and tell it what script to run.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Also try running command using backtick operator.
Code:
$res = `tchsh "test.tcl"` ;

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
That's probably easier. The only reason I suggested using exec() is that happyIndian100 said he/she wanted the return value of the script.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top