vasanthgk91 has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl `cp file1 file2`

i run this .pl file from .php file that is running on browser but its working from linux terminal

Update:
#!/usr/bin/perl `sed -i '3i\ hai' file1`

i run this .pl file from .php file that is running on browser its not working but its working from linux terminal

Replies are listed 'Best First'.
Re: cp command is not working when run from browser
by hippo (Archbishop) on Jul 03, 2014 at 13:19 UTC

    Either your web server is incorrectly configured, or your browser is broken, or your net connection is offline, or your PHP script is misconfigured or won't compile or can't shell out or your php.ini is wrong, or your path to perl is wrong or your permissions are incorrectly set or you are looking in the wrong place for the files or your action is denied by access controls or ...

Re: sed command is not working when run from browser
by InfiniteSilence (Curate) on Jul 03, 2014 at 14:10 UTC

    Why would you do this in the first place? Doesn't PHP already have a system command?

    Celebrate Intellectual Diversity

Re: cp command is not working when run from browser
by Eily (Monsignor) on Jul 03, 2014 at 13:23 UTC

    The command may not be run from where you expect to (as far as I know, it might be the folder from which php is run or the one from which perl is run, and they may be the same). You should consider using perl's chdir and File::Copy instead of creating a separate process to copy your file.

Re: cp command is not working when run from browser
by Anonymous Monk on Jul 03, 2014 at 21:18 UTC
    To help you figure it out start by examining the error message, its very much like debugging cron issue, see Re^4: Cron revisited