Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,256
Total Threads: 81,169
Total Posts: 566,839
There are 35 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming :

How to call Linux command within PHP?

Thread title: How to call Linux command within PHP?
Reply    
    Thread tools Search this thread Display Modes  
05-30-2012, 11:16 AM
#1
hirephp is offline hirephp
Status: On Vacation
Join date: Jun 2011
Location:
Expertise:
Software:
 
Posts: 1
iTrader: 0 / 0%
 

hirephp is on a distinguished road

Send a message via ICQ to hirephp Send a message via Yahoo to hirephp Send a message via Skype™ to hirephp

  Old  How to call Linux command within PHP?

How to call Linux command within PHP?

05-30-2012, 01:30 PM
#2
Ant is offline Ant
Status: Member
Join date: Apr 2005
Location: England
Expertise:
Software:
 
Posts: 209
iTrader: 5 / 100%
 

Ant is on a distinguished road

  Old

You can use backticks in php to run bash commands, if that's what you mean?

Code:
<?php
`touch filename`
This thread might help further:
http://www.rvdavid.net/execute-linux...ing-backticks/

05-30-2012, 01:59 PM
#3
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,892
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

The PHP function exec will run it, the command will be subject to the user PHP is running as.

05-30-2012, 04:13 PM
#4
.Nick is offline .Nick
.Nick's Avatar
Status: Yawn
Join date: Feb 2005
Location:
Expertise: Drupal
Software: Chromium, Komodo Edit, Eclipse
 
Posts: 1,159
iTrader: 3 / 100%
 

.Nick is on a distinguished road

  Old

If the command you run will depend in any way on user input, don't forget to run it through escapeshellcmd() or each argument individually through escapeshellarg().

Reply    


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed