0

I am using the following statements to execute a Perl script from a web site using PHP.

$perl = shell_exec('perl '.$dest.'/script.pl 2>&1 '.$mail.' '.str_replace("/", "\\", $dest));

I want to run the script server side, but it seems that it uses the Perl that is installed on the client so someone that has not installed Perl could not run the script.

I can't figure out what I am missing.

EDIT: I run:

$perl = shell_exec('C:\Perl\bin\perl.exe -v');

and figure out that was Perl server side running. So now I have to understand why some clients can't execute script.

EDIT 2: It is definitely a permission issue, only administrator could write. I' ll manage the permission.

11
  • Use full path to execute the script. Commented May 2, 2018 at 16:05
  • example: exec("/usr/bin/perl /full/path/to/Script.pl $username $password",$output); Commented May 2, 2018 at 16:05
  • 2
    You can't make your server run code on the client outside of what the browser does (e.g. JavaScript or XSLT). That's not how the web works. Commented May 2, 2018 at 16:06
  • 2
    How did you come to the conclusion that it uses the client's Perl? Do you have any error messages or log entries? Please edit your question and add these things. Commented May 2, 2018 at 16:08
  • Also, where do $dest and $mail come from? If they come out of parameters to your PHP program and you have not properly sanitised them, you could introduce a massive security problem. A malicious person could for example submit the string " && rm -rf foo #", where foo could be any directory. This is similar to SQL injection, but potentially way worse as an attacker could delete potentially your whole server. Commented May 2, 2018 at 16:11

1 Answer 1

1

There is no possibility that the IIS server is running perl.exe on the client machine. The HTTP protocol doesn't provide for anything like that

You don't say why you think this is happening, so we can't help you any further

I can only suggest that you're using the same machine for both client and server and have confused yourself

Sign up to request clarification or add additional context in comments.

3 Comments

The only thing that make me suppose IIS was running client side Perl is that only user with Perl installed on their pc can run correctly the script. Server (windows server ) and client are separated. I thought of permission issue but all user can write into the folder where the script is.
@Giovanni: It doesn't matter whether it's IIS or something else. One system cannot cause a program to be executed on another system without something specially coded to do that. You need to explain why you think this is happening.
I only supposed that cause I can’t figure out why on some clients it is not working. Is there something to check or to post that I could do?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.