php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10301 How can I execute an unix command?
Submitted: 2001-04-12 09:51 UTC Modified: 2001-04-12 10:02 UTC
From: mafra at lcmi dot ufsc dot br Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: Earlier? Upgrade first! OS: linux
Private report: No CVE-ID: None
 [2001-04-12 09:51 UTC] mafra at lcmi dot ufsc dot br
For example : 'tail -n 10 test.txt > test2.txt'
I tryed use the exec() function, but without success.

thanks

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-12 10:02 UTC] hholzgra@php.net
system(), exec(), the backtick operator `...`
and popen() should all do the job

when dealing with shell functions like output
redirection you should use system() as it
will first start a shell to run the command in

AND YOU SHOULD DEFINETLY CLICK THE DO'S AND DON'TS
LINK ON TOP OF THE ERROR SUBMISSION FORM NEXT TIME

THIS IS NOT A SUPPORT FORUM! ASK THE php-general
MAILING LIST IF YOU HAVE QUESTIONS LIKE THIS!
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC