Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Passing variables from PHP to Perl using passthru()

by BaldPenguin (Friar)
on Jun 17, 2005 at 06:17 UTC ( #467585=note: print w/replies, xml ) Need Help??


in reply to Re^2: Passing variables from PHP to Perl using passthru()
in thread Passing variables from PHP to Perl using passthru()

I was able to duplicate this as written above. Two notes though:

1) passthru() will work as described above, but the the value stored in the $result will be the exit status of the program. If it is not zero, the program did not run. If it is 127, it could not find the program. As well, passthru() is typically used for binary or raw data: use exec('command','output var','return code') to store the data retrieved form the executed command and system('command','return code') to print string data out as retrieved.

2) the results of those commands are affected by the INI_SYSTEM values of safe_mode and safe_mode_exec_dir. If safe_mode is set to yes, executable are only allowed in the safe_mode_exec_dir.

Don
WHITEPAGES.COM | INC

Edit by castaway: Closed small tag in signature

  • Comment on Re^3: Passing variables from PHP to Perl using passthru()

Replies are listed 'Best First'.
Re^4: Passing variables from PHP to Perl using passthru()
by cdherold (Monk) on Jun 17, 2005 at 06:41 UTC
    I found out what I was doing wrong. I had to grab the value sent by the php program to the perl script. The following worked ...

    PHP Script: <? $var = 1; passthru(/home/test.cgi $var); ?> PERL Script(test.cgi): #!/usr/bin/perl print "Content-type: text/html\n\n"; $var = $ARGV[0]; print "Value: $var"; OUTPUT: Content-type: text/html Value: 1

    wee hee!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://467585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2022-05-17 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (68 votes). Check out past polls.

    Notices?