problem with passthru() in php

I’m stuck with this problem for hours now.I’m trying to run this command

[php] echo $result=passthru(’/host/Crypto/newlm/./LMSignature -verify 224 -message= text -signature= ‘.$signature.’ -verifkey= ‘.$verifkeys.’ -hashfunc= '.$hashfunc);
[/php]

on my php script but I’m not getting any output.A previous command

[php] echo $signature=passthru(’/host/Crypto/newlm/./LMSignature -sign 224 -message= text -signkey= '.$signkeys);
[/php]

works fine.So I’m guessing it not an issue with permissions,access etc. All the variables like $verifkeys $hashfunc and $signature have been generated and stored in the php script.I can run the first command on the terminal by entering data manually but it isnt working in php.

The syntax i enter in the terminal is

./LMSignature -verify 224 -message= text -signature= [keys] -verifkey= [keys] -hashfunc= [keys]

ANy help?Thanks

are the brackets used in the command line function or are you just including them for the key info if they are included the issue maybe that your variable do not include brackets.

Try it this way
[php]$pass = “/host/Crypto/newlm/./LMSignature -verify 224 -message= text -signature= ‘.$signature.’ -verifkey= ‘.$verifkeys.’ -hashfunc= '.$hashfunc”;
$result = passthru($pass);[/php]

http://php.net/manual/en/function.passthru.php

Nope those are just there to indicate that the data goes there…
e.g ) ./LMSignature -verify 224 -message= text -signature=11239181 11239179 11239183 11239191… (goes on and on)
same for -verifkey= and -hashfunc=

All these keys are generated and saved .I just need to pass them to the C program via terminal execution.

that was my first try :stuck_out_tongue: but its still not working :frowning:

You will need to define the exact location of the LMSignature script in the variable as if you were typing it into the terminal from the root of the file structure.

I’m sorry I dont follow you. /host/Crypto/newlm/ is the exact location of the LMSignature program

Unless you have a folder call . i don’t think you need the ./ i think you can just use /host/Crypto/newlm/LMSignature …

but you may have to set the script to executable if it is not already.

although i do not know why the other one would work with the same structure and this one would not.

example: http://www.php.net/manual/en/function.passthru.php#59507 and the one below it.

I looked at your link but I;'m already giving the full path so I dont know what else I can do. Do you know anyother way i can complete this task without resorting to passthru(),exec() etc.

did you try it without the / ./

I did but i get the same result-nothing.

does it work if you only have one key value instead of several? you may have to loop though the single values.

Sponsor our Newsletter | Privacy Policy | Terms of Service