Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

cp command is not working when run from browser

by vasanthgk91 (Sexton)
on Jul 03, 2014 at 13:08 UTC ( [id://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

Replies are listed 'Best First'.
Re: cp command is not working when run from browser
by hippo (Bishop) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-24 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found