in reply to Execute a perl script from PHP?

So an update to this: If I run the script manually using my own login it works. However if I try to sudo -su to the web server's username it never connects w/Net::OpenSSH. Which then leads to it failing the telnet part also. I'm guessing its a permissions issue that the webserver is not able to do the SSH but I get no log entries indicating any problems.

Replies are listed 'Best First'.
Re^2: Execute a perl script from PHP?
by Corion (Patriarch) on Apr 02, 2016 at 07:22 UTC

    Maybe your web server machine runs SELinux or something that prevents the Apache user from making outbound network requests.

    If you can reduce the Perl script to a minimal, self-contained script to reproduce the problem, maybe somebody can find the reason why things don't work.

    Have you tried launching the script directly, without PHP in the middle? Maybe from a shell script or a tiny Perl script.

Re^2: Execute a perl script from PHP?
by MidLifeXis (Monsignor) on Apr 04, 2016 at 15:58 UTC

    There is also the potential that this is an environment issue or permissions. There are variables that can change where stuff is looked for on the system (LD_LIBRARY_PATH, PERL5LIB, PATH, ...) that may be set differently on a user-by-user basis.

    You could do an env from your own login and the login of the web server, and compare the differences. I would guess that the web server is a bit more restricted / limited / just plain different than your user's environment.

    --MidLifeXis