473,395 Members | 1,537 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,395 software developers and data experts.

please help lauching programs through php system and exec

respected i have launch a application using the php . like nmapfe or ethreal but the basic functions like system and exec is not workiking ... the safe mode is also off .. please tell me the way to lauch these kind of console application using hyperlinks or buttons ...
other etst return system commands work like ls ... but console is not opening
Jan 25 '07 #1
11 1997
ronverdonk
4,258 Expert 4TB
You are double posting! Please read the Posting Guidelines before you post in this forum!. The double thread is removed.

As to your question. Since you are running in safe mode, you must take some precautions.
If PHP is used in safe mode, system() and the other functions executing system programs refuse to start programs that are not in this directory. You have to use / as directory separator on all environments including Windows.

Note: When safe mode is enabled, you can only execute executables within the safe_mode_exec_dir. For practical reasons it is currently not allowed to have .. components in the path to the executable.

With safe mode enabled, the command string is escaped with escapeshellcmd(). Thus, echo y | echo x becomes echo y \| echo x.
Are you starting these applications of yours from the same directory as your script?

Ronald :cool:
Jan 25 '07 #2
sorry for double posting .
and as i have said that my safe mode ooption is off not on ...as one possible confusion occurs due to that . now how can lauch the application like nmapfe
or ethreal which opens as a console . the other commands like ls and echo are working the same .
example
system("ethereal"); // this is not working
but
system("ls "): // but this is working showing the results ... text



so what is the problem .
is it not possilble to do that .. in php
thankyou .
sorry again for double posting
Jan 25 '07 #3
Motoma
3,237 Expert 2GB
You will need to check what user your web service is running as.
Depending on the environment for that user, the programs you are trying to call may not exist in the folders specified in the $PATH for that user.
You may want to try this: use the entire path from / for the program you are trying to call:
[PHP]
system("/usr/bin/ethereal");
[/PHP]
Jan 26 '07 #4
respected
the code you have written i have already tried it and it is not working .
code
system("/usr/bin/ethreal");
and using the system call not even the daemons can be run.
i want to start the daemon of ntop daemon but the same is not running



is there any limitation of the system call that it can not start the daemon process and fire the application (which is the console based application like ethereal or like nmapfe).



please please help whole project is blocked due to this .

or give me some alternative to how to go about this problem
thankyou...
Jan 29 '07 #5
Motoma
3,237 Expert 2GB
respected
the code you have written i have already tried it and it is not working .
code
system("/usr/bin/ethreal");
and using the system call not even the daemons can be run.
i want to start the daemon of ntop daemon but the same is not running



is there any limitation of the system call that it can not start the daemon process and fire the application (which is the console based application like ethereal or like nmapfe).



please please help whole project is blocked due to this .

or give me some alternative to how to go about this problem
thankyou...
In order for php to start off a daemon process, the web user will need to have the permissions to do so. You will need to check your web-server configuration to determine the user that your web-server runs as, and then allow that user to perform the necessary operations. An easy way to determine if a command can be run from a php script, is to switch to that user, and run the command just as you would type it into the system() function:

Expand|Select|Wrap|Line Numbers
  1. # su - apache
  2.  
  3. $ /usr/bin/ethereal
  4.  

PLEASE NOTE: I do not know the location of the program you are trying to run, /usr/bin/ethereal was just an EXAMPLE of what you might need to do to properly run a program using the system() call.
Jan 29 '07 #6
respected
i have tried that earlier only making my self super user and than executing the command .
please can u test command where you invoke the application in throught the web page and see the results . It will be very helpfull you could start a applicatio n like ethereal with a click on a hyperlink in the web page .
i am not getting through you about my problem so if you could give the steps it will be very helpfull
thankyou
Jan 30 '07 #7
Motoma
3,237 Expert 2GB
respected
i have tried that earlier only making my self super user and than executing the command .
please can u test command where you invoke the application in throught the web page and see the results . It will be very helpfull you could start a applicatio n like ethereal with a click on a hyperlink in the web page .
i am not getting through you about my problem so if you could give the steps it will be very helpfull
thankyou
I am having difficulty understanding exactly what you are trying to accomplish. If you could, please explain what you want to accomplish, the difficulties you have encountered, as well as your thoughts, I am sure I will be of better help to you.
Jan 30 '07 #8
respected
the problem i am facing here is that .
i have to make a web page using php where i have links to network tools like ntop , ethereal , nmapfe etc .
i have hyper links that point towards these links and the selected tools gets invoked .
now for the web based tools like ntop i simply give up the port number and the it gets launched .
but some of the console related tools like nmapfe and ethereal i have problem launching them .
i have used the system command and many other alternatives but the console is not getting launched .
plus i have to start the daemon also using the hyperlinks ... like daemon of ntop .. with a click ...
so main problem is how to launch a application and start a daemon ...
please i have tried everything in my knowledge .
please get me through that .

thankyou .
Feb 7 '07 #9
Motoma
3,237 Expert 2GB
From the command line, type "whereis ethereal"
You should see a full path to the ethereal binary; this is the path you will need to type into the system function. For instance:

Expand|Select|Wrap|Line Numbers
  1. # whereis wireshark
  2. wireshark: /usr/bin/wireshark /usr/sbin/wireshark /usr/share/wireshark
  3.  
This tells me that I will need to use one of the following:
[PHP]system("/usr/bin/wireshark");
system("/usr/sbin/wireshark");
system("/usr/share/wireshark");
[/PHP]

Let it be known, wireshark and nmapfe both require root privilages to use their full functionality.
Feb 7 '07 #10
respected
i have tried the same but for the some reason the required application is not firing up .
i have given the same system call for the ls command but that is working
but just that the application console is not firing up .

OS is linux EL 4

is there any another way that i can by using the hyperlinks in my website
i can fire the application with a click .

this is very important to me . and whole project depends upon it

thankyou
Feb 8 '07 #11
Motoma
3,237 Expert 2GB
respected
i have tried the same but for the some reason the required application is not firing up .
i have given the same system call for the ls command but that is working
but just that the application console is not firing up .

OS is linux EL 4

is there any another way that i can by using the hyperlinks in my website
i can fire the application with a click .

this is very important to me . and whole project depends upon it

thankyou
Remember, nmapfe and ethereal both need root access to start. That means they will ask you for a password. And be running as your web user. Which means they will not display on your X11 screen regardless of what you do. And the only way to get the password in is to type it into the box that pops up.

What you may want to try is running regurlar old nmap(the command line version of nmapfe) and tethereal (the command line version of ethereal).
Feb 8 '07 #12

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

Similar topics

2
by: Thang Nguyen | last post by:
Hi, my page contains an applet. When I click on a link on the page, the applet will be launched.Now I need my page can be automatically closed when I close my applet.I can call the script from my...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
7
by: Coca | last post by:
Hello, all I am working on a project that needs to convert OS/2 C60 programs into MS windows programs. And I found it difficult to find useful information. Could somebody kindly help me ? any...
2
by: Allan Adler | last post by:
In C, I can execute system("gs gleep.ps"); and have C run a ghostscript program gleep.ps, which might ask for user input and, when it gets it, take some actions and report back to the C...
3
by: prabhupr | last post by:
Hi Folks Not sure if this is the right group, if not please re-direct me to the right one. Here is my question =============== When I compile my ASP.NET WEB project from VS 2005 (.NET...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
26
by: Chief | last post by:
Hello i would like to know which syntax do i have to use in order to make a program run other *.exe program and also how to put inputs in it for example i want to to make a program that run...
6
by: drhilbert | last post by:
Dear all, in these days, we have found a problem we can't solve even after long long googling, so we are here asking your precious help. In our program instead of using cout to print messages...
35
by: jleslie48 | last post by:
I've written a cgi program in C using the borland 5.5 free compiler, and it runs just fine on an Apache server. My only issue is if I issue some system calls the cgi suspends until the call...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.