General :: Executing PHP File And Read Output To Program
Jun 29, 2011
I'm using Ubuntu and I'm programing with eclipse CDT. My goal is to execute a php file and read the output to my c++ program. To do so I thought I should use fork(), dup2() and execl. When in shell, the call "php myscript.php" worked just fine, but when in c++ I tried:
execl("usr/bin/php", "php", "home/geiger/workspace/SemiServer/server_content/myscript.php", NULL);
And it didn't work (the process wasn't terminated and I got no output). I tried different version of this call, like losing the "php" string and/or drop "home/geiger" from the path string, to no better result.
Binary files need only execute permission to execute. No read permission is required. But all executable files must be read by the kernel into main memory before executing. Also script files need both read and execute permissions for executing the file.
I am looking for a clue in shell or ant script, where I excecute a binay file on linux. For example ./myfile.bin which ask me few questions.
./myfile.bin ...........................100%
I would like to automate this process where I want to pass the hostname as a variable or read from a file is it possible? If yes any sample`s on this. I can do if this was a shell script ($1) but not sure when its binary.
I have a script, I am able to send the output of the script to both the screen and a file as shown below
Code:
./script | tee -a temp.log
I wonder is it possible to achieve same thing by executing some commands inside the script. As for other users, who execute the script it is not advisable to pipe the output of script with the help of tee command. Again, keeping |tee at the end of every line of the script doesn't seem to be advisable. I tried with this for couple of lines and it works. Is it possible to get the output of script to both screen and file by just executing name of the script, with some script tweaking ?
file1: have DNA sequences and each sequence will begin with > symbolfile2: have protein sequence and each sequence will start with > symbolfile3: BLAST result of file2 and each result will start with query= .my problem is i have to make a report file by combining these three in such way that first sequence from file1,first sequence from 2nd file and first result from file3 should be printed in a report file
i have many text files in my directory and when i click on them to open them os treat it as a runnable file any says display or run or run in terminal ... i want to pick up recursively the tick of "Allow executing file as program" for all files.
I'm having a slight dilemma on reading data from a text file and outputting it into a table then displaying it. Basically I'm writing a shell script that takes information from text files then outputs the data into a table with 4 headings.he extracting of the data is fine, but creating a table i'm having problems with. I think it is possible to do it using the awk function, but so far i'm having a lot of difficulties.
Im trying to run a program but my system won't let me.i used to be able to run executable files without a problem but i can't anymore when i double click the file i get "there is no application installed for executable files" i am unable to check "allow executing file as program" in file properties there is a script file which runs the program but all i get from the terminal is "permission denied"
I am writing a script which will fetch data from different machines and display it on single terminal. I have created a file named SERVERNAMES containing ip address of machines I need to monitor. Then for every IP I am issuing ssh command to get date on that machine. However When I am trying it on the script it is just giving me output of first server and it is ignoring rest servers mentioned in file. ssh works fine without password for all machines mentioned in SERVERNAMES.
Code: #!/bin/bash while read line do #Calculate Load on remote machine. Date=`ssh -T -q $line date` echo "Date on $line is:$Date" done < SERVERNAMES
Code: output. Date on 10.180.8.231 is:Wed Jul 14 10:48:46 IST 2010 I am not getting the output for . Code: 10.180.45.235 10.180.45.238 10.180.45.211 Is there anything wrong in ssh?
How to remove unwanted output that comes from executing system api?
for eg:when i execute system("telnet 127.0.0.1") i want the output to start with login and then password and then directly the command prompt,how can i remove the output that gets generated before showing the prompt?
A bunch of my .rtf files suddenly (within the last few days, not sure when) have the "Allow Executing File as Program" box checked under their file Permissions. So whenever I try to open an rtf document, it asks if I want to run it. What's up with that?
Is there already a program that reads multiple pipes or file descriptors and writes to the standard output (not splitting lines).Like cat, but reading all files simultaneously and preserving lines.It is needed to avoid coding of select/epoll loops or using multithreading in simple programs. Like "select loop for bash".
I'm trying to run an application from the command prompt. I've set the path in .bashrc. My executable file and all other files needed by it are saved in the same directory as the path. When I enter the executable name to run it, I get an error message saying that the command is not found.
i have wrote a long piece of code above with the "main" which is calling openFile( &fout, filename )filename contains the txt name in a form of "data.txt"i wanna read the data from the file and output it into fout for later use.the data in that file is a vector looking interger group.i have the following code:
ive got a second hard drive which is ntfs. it's got some windows programs that i'd like to run in wine. problem is i can't get "allow executing file as program" to work. when i click that, it doesn't stick.
What are the possible problem when Windows access the file from Ubuntu got Read Only even though have a full permission to read, write and execute the file? Ubuntu to Ubuntu accessing the file there is no problem only Windows got a problem.
I am learning Linux daemon programming and write a simple daemon program. The issue is no data is written to the log file (/var/tmp/simpledeamon.log) though the file is successfully created (it's file size is zero from ls -l output). Could someone kindly point out the error in my program,The code is based on the Devin Watson's article at Here is the code:
// simplydaemon.cpp // A simple Linux daemon. #include <sys/types.h>
i am trying to write a program which will read input from a text file, check if each line contains any alphabets and then display a message imforming me if there is an alphabet in each line. My text file is formatted in this way...
My present working is Code: linux:/home/anisha/downloads/mapnik-0.6.1/demo/c++ # Now I want to run "python scons/scons.py" located in Code: linux:/home/anisha/downloads/mapnik-0.6.1/ #
I tried Code: ../../python scons/scons.py From the above stated PWD but it resulted in the following: Code: bash: ../../python: No such file or directory What is the way to execute a file of some other directory from the PWD!
After downloading any program thats in ubuntu or uses wine to run before i can run it i've got to allow it to execute, is there a workaround for this? Im using 10.04 ubuntu desktop
Using gnome terminal (Ubuntu 10.10), is there a way to execute the default application associated to a file type, only by typing its name, as it is possible with Windows ?
For example, say I create a mime type associated to every file with the pattern *.abc. Lets say I associate this file type to application 'my_app'.
If I have file 'my_file.abc' in current folder, what I want is that when I enter only 'my_file.abc' at the prompt, it executes 'my_app' feeding it with 'my_file.abc' as first argument. (assuming of course 'my_app' is in the path)
while doing socket/network programming, i am getting SSH-2.0-openssh4.7 error, instead of showing day time of server.general description i have Linux Box, with the help of putty i am connecting from windows system to Linux box,no problem in loging,after typing program, i am running the program with gcc. when typing ./a.out, it is showing SSH-2.0-openssh4.7, actually it should display daytime from linux box in both tcp and udp.
I m using ubuntu 10.04. I have install flightgear Scenery designer(fgsd) and it executed successfully, but during working on it I selected any option of it and fgsd crashed. After that it is not getting execute. Throwing following error on console. buffer overflow detected ***: fgsd terminated
Pavillion laptop crashed and I can not find all of my recovery discs. The computer will not allow me to do an internal recovery so I ordered a recovery download on line and burned to a disc. when I put the disc in the graphics came up and in started in Live-mode but then the error mess came: error while loading shared libraries: /usr/lib/libpci.so.3: cannot read file data: input/output error. The site said it was an ISO file but then it had a program it had me run to change it and burn the disc.