473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Run Command Line from PHP in Ubuntu 8.04

Hi..
how to run command line from php in ubuntu 8.04 ?

Thank you
Aug 2 '08 #1
3 4234
Laharl
849 Expert 512MB
If there's a system() or similar function in PHP like in C or Python, you can call /usr/bin/bash to create a full shell or just pass in the commands you would want to run in that shell.
Aug 2 '08 #2
If there's a system() or similar function in PHP like in C or Python, you can call /usr/bin/bash to create a full shell or just pass in the commands you would want to run in that shell.
Thank you

Would you like to give me some examples ...

Thank you
Aug 3 '08 #3
Laharl
849 Expert 512MB
Keep in mind that I know absolutely no PHP, nor do I even know if this function exists in that language...

C(++):
Expand|Select|Wrap|Line Numbers
  1. //This would need main()/etc
  2. system("/usr/bin/bash");
  3.  
Python:
Expand|Select|Wrap|Line Numbers
  1. import os
  2. os.system('/usr/bin/bash')
  3.  
Actually...you should probably use exec() or popen() (Google for how to use them, I'm not entirely certain), as system() under *nix passes the parameters passed to it to the shell as commands to be run rather than starting a new process.
Aug 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: JS | last post by:
When I write g++ in a shell I get the errormessage: g++: command not found But when I open Synaptic and search for g++ I have both  g++-2.95/3.2/3.4 listed as being installed. Hope someone...
6
by: Jon Hewer | last post by:
hi i am writing a little script and currently implementing command line arguments following the guide by mark pilgrim from dive into python; ...
16
by: John Salerno | last post by:
Here's my new project: I want to write a little script that I can type at the terminal like this: $ scriptname package1 where scriptname is my module name and any subsequent arguments are the...
6
by: ThomasC | last post by:
Hello, How to configure Python2.5's interactive interpreter to get command history ? I always got ^[[A and ^[[B . Thank you !! Thomas#
6
by: =?iso-8859-1?q?Luis_M._Gonz=E1lez?= | last post by:
Please forgive me if what I'm asking is non sense... I created a little program to authomate the creation of the "setup.py" script for py2exe. It simply prompts for the main executable script...
2
by: Jim | last post by:
Hello, I need a program that will traverse a directory tree to ensure that there are unix-style line endings on every file in that tree that is a text file. To tell text files from others I...
9
by: jgentes | last post by:
On my site I do a weekly backup of our server and the mysql databases. The problem I am having is restoring / updating the backup server's mysql data. There are 2 databases that I need to restore /...
4
by: neha_chhatre | last post by:
please let me know if am using command line arguments, how to send arguments to a C program if i am working on ubuntu say for example suppose name of my program is prog.c if argc=3 then how...
12
tpgames
by: tpgames | last post by:
If the error message says Bad key or directory name: "/apps/gnome-alsamixer/display_sliders/SigmaTel_STAC9708,11-Master": `,' is an invalid character in key/directory names What do all do you...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.