Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

cp command is not working when run from browser

by vasanthgk91 (Sexton)
on Jul 03, 2014 at 13:08 UTC ( #1092164=perlquestion: print w/ replies, xml ) Need Help??
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

Comment on cp command is not working when run from browser
Select or Download Code
Re: cp command is not working when run from browser
by hippo (Curate) 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: cp command is not working when run from browser
by Eily (Chaplain) 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: 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 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1092164]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2014-11-29 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (203 votes), past polls