Shell_exec() Return Nothing
I ran into a problem with shell_exec() PHP and all files hosting on Redhat I have a html page that allow me to enter a linux command, then submit, then I get the output print out between $output.
when enter command: ls -l /etc, it a list of file and directory on /etc as expected
however, when I tried to execute my program at /etc/earch/esearch (esearch is executable), I received nothing back.
however when I telnet to server, command /etc/earch/esearch does return some text.
i'm sure php was running as same user as telnet.
View Complete Forum Thread with Replies
Related Forum Messages:
- Shell_exec Return Code
- Return 30 Or The Amount Of Actual Rows The Query Would Return If It Wernt For The LIMIT.
- Shell_exec Help Please
- CLI And Shell_exec()
- Ssh With Shell_exec
- SSL Through Shell_exec
- Cd With Shell_exec
- Shell_exec
- Basic Shell_exec
- Exec Or Shell_exec
- Shell_exec Need Any Configuration?
- Shell_exec, Python
- Shell_exec On LightTPD
- Specifying Paths Using Shell_exec
- Exec()-shell_exec
- Shell_exec - Cd Is Not Working
- Shell_exec( ) Function
- Exec And Shell_exec
- Shell_exec On The Localhost?
- Shell_exec And Variables
- Shell_exec() Output
- Output From Shell_exec
- Shell_exec Not Working On Win2K3
- Shell_exec Causing CGI ERROR
- Shell_exec And Perl::Expect.pm
- Shell_exec() Works Randomly
- Shell_exec() Server (fedora 3.1)
- Problem: Exec() And Shell_exec()
- Capture Shell_exec Output With Newlines
- Calling A Java Program With Shell_exec()
- Shell_exec And Output Catching Problem
- Output Of Shell_exec Has Block Characters
- Shell_exec() Command - Linux's Shell
- Exec(), System(), Shell_exec(), Etc + Nmap
- Shell_exec Background Process *Windows*
- Can't Execute Mail() Or Shell_exec, Safe_mode Is OFF.
- Shell_exec Returns Permission Denied
- Shell_exec('service Dhcpd Restart')
- Return False Or Return True
- Exec, Shell_exec, System, And Passthru Not Working At All
- Shell_exec :: Create A .pdf From A Series Of .tiff Images
- Exec Or Shell_exec For Dumping MySql Info?
- Shell_exec Using System Tools - Wait For Process To Finish
- Exec And Shell_exec Not Executing Batch File Properly
- System(), Exec(), Shell_exec(), But "Permission Denied"
- Return A Value
- Return 0
- Return The Key
- Return?
- Return()
- Return MAX Value From Array
- Class Does Not Return A Value
Shell_exec Return Code
The return code of shell_exec function is the return code of the executed command. What happens if i'm trying to execute a non existing program/script? What is the return code? ie $output = shell_exec('lss -lart'); and 'lss' is not present in the same folder as the script?
View Replies !
Shell_exec Help Please
I have an ensim server which provides me with about 20 scripts in the filesystem that allows you to create sites, edit them, lookup domains, etc... I am running a few of these scripts from a cron I made and that all works fine but I can't seem to find a function (like shell_exec) that allows me to get the text returned from the function. When I run the script from CLI and i run the script using either system(), exec(), passthru(), or shell_exec() it just displays the results, and I didn't tell it to, it just does it on it's own bit. My question is how can i trap the results so I can anylize them.
View Replies !
CLI And Shell_exec()
I am using Imagemagick and some other apps via command line calls (if I stated that correctly, hope so).I run a WinXP server, Sambar 5.3. I use this format for my typical call: PHP Code:
View Replies !
Ssh With Shell_exec
I'm trying to 'ssh' into another machine, run a small script and fetch it's output, using shell_exec(). The problem is, it takes AGES to run ssh and I don't know what's happening. If I try 'ssh'ing manually on the shell, it takes a microsecond to fetch the result, whereas shell_exec takes very very long and I don't know how to debug the problem. That's problem number one: How do I tell what's happening and why is it taking so long? Problem two: To be able to establish a password-less ssh connection, I generated a public key/private key pair for the two machines and stored it in my /home/username/.ssh directory. Okay, I know apache/php (by the way I'm running apache with PHP 4.2.3) won't know where to find it so I presumed /opt/apache/.ssh would be the best place to copy the ".ssh" directory (i.e. apache's installed in /opt/apache). Now the problem is, I couldn't get shell_exec to run ssh in a password less mode. After a little while I realized that it was looking for the private key in "/.ssh" (i.e. the root directory)! How come? How do I change it so that it looks for the .ssh directory elsewhere? (I mean, how can I run a command using shell_exec and ask it to use the "home" directory of the "apache" user, which normally is /path/to/apache)? The last time I installed php & apache, I remember it looked for the .ssh directory in the /opt/apache/.ssh directory and now it has changed. also, it was much faster the last time. Now for some reason it's EXTREMELY slow (takes a whole minute to run ssh) and looks for the .ssh directory on the root (and I dont want to place that directory there).
View Replies !
SSL Through Shell_exec
I've looked at the php documentation for openSSL, but found that the module seemed insufficient for purposes like checking a certificate's expiration date on another server. That is, I could not find a function to run "openssl s_client -connect", so I decided to instead achieve it through shell_exec. This is a three step process: 1) Check the openssl version via shell_exec('openssl version -v'); just to confirm that openssl is installed and runs properly. This returns "OpenSSL 0.9.7a Feb 19 2003 " 2) Connect to the remote server. As a test, I decided to use www.gna.org, since I know they use a certificate. shell_exec('openssl s_client -connect www.gna.org:4433'); This pauses for about 20 seconds, and then returns FALSE. I've tried various combinations, like removing the -connect argument but leaving the server name in, removing the port, including the https:// part, removing the www, and so on. I have not tried a port other than 4433 yet (I wouldn't know what other part to use). All other methods returned FALSE immediately. This is the only method that delays 20 seconds, which indicates to me that I'm close. 3) Fetch certificate expiration date via shell_exec('openssl x509 -enddate'); although this obviously returns FALSE because I have not been able to connect to the server yet.
View Replies !
Cd With Shell_exec
I have the following script: $c_path = "/absolute_path_to_some_directory"; $test_cmd = "cd $c_path; ls"; $test_res = shell_exec($test_cmd); it always lists the contents of the directory where it is placed, rather than the contents of some_directory. In other words, it appears that cd is not working. I have verified that path and permissions are correct. PHP is version 4.3.9.
View Replies !
Shell_exec
I want to copy file from remote machine to local machine using PHP. On both machines Linux operating system present. The code is. $result=shell_exec("scp admin@192.168.1.236:/mnt/disc/hda/part1/demo/ conn /opt/lampp/htdocs/upload/");
View Replies !
Exec Or Shell_exec
I am trying to us shell_exec and keep getting an error. I do have safe_mode = off also. Code: if ($publish == "yes") { $command = "e:scriptspublish.bat"; $result=shell_exec($command); } The publish.bat file does work and I have proper permissions set in windows, I set everyone full access. Oh, Windows server, IIS6.0, PHP. Error is as follows: Warning: shell_exec() [function.shell-exec]: Unable to execute 'e:scriptspublish.bat' in
View Replies !
Shell_exec, Python
Read some garbage tutorial on About.com about embedding my python script inside PHP with shell_exec() but it's not working, as I expected. Does some kind of configuration have to occur first for this to happen? I have python installed but I can't run it from anywhere at my dos prompt. I have to be in the python25 folder (i installed using a windows installer on python.org) for it to work. I'm running IIS, Win2000, Python 2.5.1, PHP 5.2.3
View Replies !
Shell_exec On LightTPD
I've got a very simple script with shell_exec that's giving me a headache! My server is a NetBSD machine running LightTPD (1.4.8nb1) and php (5.1.1nb2). I've got the file dummy.php with the following content: <?php error_reporting(E_ALL); $res = shell_exec("pwd 2>&1"); echo $res; ?> When I access this file through a browser i can't see any output: http://my.url/dummy.php results in a blank page that loads in no time! No error messages, neither output by the browser or in the log files (php.log and LightTPD's error.log). When I use the terminal on the servern it all works fine: php /path/to/wwwroot/dummy.php gives me the working directory. Doesn't matter from which working directory I execute the command, or which user (I've tried the LightTPD user aswell). It works every time! safe_mode is off and there are no disabled_functions! I've asked around in LightTPD forums, but they say it's a PHP problem. So, I've asked around in (other) PHP forums but noone seems to have any ideas how to solve this! Perhaps there are expert users here that can help me, or at least redirect me to some other expert forum.
View Replies !
Specifying Paths Using Shell_exec
i use xampplite locally, winxp. from PHP, this creates a blank mydump.sql file: shell_exec("mysqldump --allow-keywords --opt -uroot mydb > mydump.sql"); but this works fine: shell_exec("c:xampplitemysqlinmysqldump --allow-keywords --opt -uroot mydb > mydump.sql"); but if i use the second one on my pages, im afraid the code might not work anymore when i transfer the site to my server, because of the path. any suggestions???
View Replies !
Exec()-shell_exec
my server: apache2/php5 and win2k3. I'm able to use shell_exec or exec for dos command that doesn't require auth. I would like to exec certain dos command under "domainuser" "password" .So I'll be able to access remote computer etc... example: echo shell_exec(find /i "SomeDataImLookingFor" "RemoteWorkstationc$ ext.txt) if i use this command in a dosshell under my user session it will return data.Of course if i execute this with PHP on the server with the phpserver account it won't function. I have been looking for a while on google and forums but i can't find it ,i just need someone to point me to the right page/post/.
View Replies !
Shell_exec - Cd Is Not Working
I have the following script: $c_path = "/absolute_path_to_some_directory"; $test_cmd = "cd $c_path; ls"; $test_res = shell_exec($test_cmd); Regardless of where I put the script, when executed, it always lists the contents of the directory where it is placed, rather than the contents of the some_directory. In other words,it appears that cd is not working. I have verified that path and permissions are correct. PHP is version 4.3.9. What's wrong ?
View Replies !
Shell_exec( ) Function
i trying to use shell_exec on a unix-type platform and can't seem to get it to work. Can anyone help me with the shell_exec command problem? below is the coding of my: <?php $output=shell_exec('ll -lart'); echo "$output"; ?> suppose when i run this two line of php coding, there should be a output displayed. but no output displayed.
View Replies !
Exec And Shell_exec
I'm new to running exec commands on php. I've had ffmpeg installed on my server, at /usr/local/bin/ffmpeg (a cmd line video decoder). It's a linux server, running php5. From looking around the internet, I came up with this code to run it: Code:
View Replies !
Shell_exec And Variables
I'm trying to execute a shell command within a loop to fetch a filename that is stored in an array, but it's not substituting the array with the contents of the array. Here's what I have: Code:
View Replies !
Shell_exec() Output
I am trying to get information from a shell on my server by using shell_exec() but the outputted data is not formatted and I cannot for the life of me figure out how to make the output appear how I want it. For example if I do a whois query I get the full output with returns so it is all dumped on 1 line. Is there a way to make the outputted data appear the same as if I had performed the same query using SSH? Is there a way to make data from a traceroute appear line by line instead of waiting for the query to execute completly before dumping the data? I am assuming it can be done with Java but I am not sure.
View Replies !
Output From Shell_exec
i'm having trouble with shell_exec. according to php.net the output of the command is returned by shell_exec(), but this is not the case. i've tried exec,passthru and system but can't get the output into a variable. PHP Code: $ffmpeg = escapeshellcmd('ffmpeg -i "'.$uploadPath['orgVideo'].$org.'"'); $tmp = shell_exec($ffmpeg);Â Â Â Â Â Â Â Â echo " "; print_r($tmp); echo " "; .....
View Replies !
Shell_exec Not Working On Win2K3
We have PHP 4 installed on Windows 2003 with Apache 2, and the shell_exec has mysteriously stopped working - it hangs the page rather then returning anything. To check it out, I tried shell_exec("dir") which works fine on the development machine, but not on the live server. I'm guessing the network guys have done something to the security of the live server that would cause this - but it's very strange; why would Apache (running under the default system account) not allow PHP to run shell_exec statements? I have checked PHP and it's not in safe mode. I'm a bit stuck -
View Replies !
Shell_exec Causing CGI ERROR
I have a php page that needs to call a batch script. My test script has one line: echo test. I am running Win2003 Server, IIS, and php 4.3.10. When I first tried running my php script I got an error that said "unable to execute ...". Then I granted the IIS user execute privledges to cmd.exe (I know, I know ... security risk). Once I did that, my script gives me a CGI ERROR - something about http headers. I've scoured google groups and come up with nothing that works. I tried one solution that uses an executable called bgrun.exe. That exe calls my batch script - still no luck. I've tried exec() and shell_exec(). No difference. I've tried saving the result to a variable and not. No difference.
View Replies !
Shell_exec And Perl::Expect.pm
I have a perl script that I'm calling using php's shell_exec that uses an expect module to go to another system to pull tiff files. The php perl combination works great when I launch from the commandline: $php docpull.php I get the files I want. Everything is perfect. When I run docpull.php through the web server I get to the expect call in the perl script where the password is passed and the script fails. No error in any of the logs or return from either php or perl. I believe that its an environment issue regarding how php is run through the web server and what the expect module from perl needs for a pty. I think this is the case because I can see the scp command output that perl expect is generating gets to the password but after that there is no error. Expect needs to have a pty to work with and I think that when I run through the command line I have one but when I run through apache I lose access to ptys. Permissions don't seem to be a problem because I've set up all of the directories involved with uncomfortably open perms and I've run the command line version as the Apache user. I'm reaching at this point. Because of another server limitation I'm stuck with php 4 and Apache 1.3 for the time being. If anyone has any other suggestions for pulling files from a remote server I'd be happy to give them a try, however, the scp with expect will solve lots of other problems I'll have to deal with. I'm on slackware linux 10.2 Apache/1.3.33 (Unix) PHP 4.4.1 (cli) (built: Dec 21 2005 03:44:49) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Xdebug v2.0.0beta5, Copyright (c) 2002, 2003, 2004, 2005, by Derick Rethans This is perl, v5.8.7 built for i486-linux The expect module I'm using is Expect-1.20
View Replies !
Shell_exec() Works Randomly
In another post I told about PHP not being able to create dates earlier than 1970, so until I can get PHP to do so, I am using a small perlscript to do it. It looks like this: //$in[date]*is something like "1943-10-12"; $unixtime = shell_exec("bin/converttime.pl $in[date]"); Problem is, this fails once ever twenty times or so - shell_exec() doesn't return anything. This is true of another place where I use shell_exec() to run /usr/bin/cal so I don't think the problem is with the application I am trying to execute.
View Replies !
Shell_exec() Server (fedora 3.1)
i have full access to the shell of the server (fedora 3.1) but running this code in a php file on xampp server that i have on the same server , i am not getting the output even when i am trying to pipe the output to an html file . Code:
View Replies !
Problem: Exec() And Shell_exec()
I've got the following problem: exec() and shell_exec(), etc. don't give anything back, just the error code 127 For example, the following script: <?php exec("cat ./test", $lines, $result); // or exec("./cat ./test", $lines, $result); echo "result = $result<br>"; echo "Lines<br> "; foreach ($lines as $k => $v) { echo "k=$k v=$v<br> "; } ?>
View Replies !
Calling A Java Program With Shell_exec()
I couldn't compile php with java support on Mac OS X so I thought I'd call my java program with shell_exec(). It does work for simple programs ("hello world") but if the program gets more complex php just gets back an empty string (although on the command line the java program prints out what I want). Any ideas why this happens?
View Replies !
Output Of Shell_exec Has Block Characters
I am doing a shell_exec that calls an expect script from the shell. The output that I get back from calling shell_exec has rectangular blocks in a lot of the output. I was wondering if anyone knows what causes these, and how to get rid of them.
View Replies !
Shell_exec() Command - Linux's Shell
I've came up with an issue when trying to work on Linux's shell using PHP it seems to work when I issue the following commands, shell_exec("iptables -h");, shell_exec("ls"); and shell_exec("ifconfig"); however when I'm trying to do something like this, shell_exec("iptables -L") or shell_exec("iptables restart"); it doesnt seem to work.
View Replies !
Exec(), System(), Shell_exec(), Etc + Nmap
i'm trying to create a script that executes nmap from my server, then displays the output. i've tried: $output = passthru('nmap -v -A'.' $ip'); $output = shell_exec('nmap -v -A'.' $ip'); system('nmap -v -A'.' $ip'); the problem i'm having is that using the above methods i only get the first line of output, ie. Starting Nmap 4.20 ( http://insecure.org ) at 2007-08-31 21:46 CST and nothing else. i've managed to find a way around it by sending the nmap output to a textfile, the using file_get_contents() to pull the data back in: exec('nmap -v -A '.$ip.' > /usr/local/www/apache22/data/nmap/'.$ip.'.html'); $file = "/usr/local/www/apache22/data/nmap/$ip.html"; $result = file_get_contents($file); echo "(pre)$result(/pre)"; that works perfectly, but i'd rather not be writing anything to the drive. i guess the problem might be that nmap takes about 5-10 seconds to do its scan, and for some reason php doesn't want to wait that long, i really have no idea. can it be made to work without needing to write to files? and for the curious minds, i'm not doing anything dodgy, i just wanted an online tool i could access from any computer to test networks i support .
View Replies !
Shell_exec Background Process *Windows*
I am trying to get a shell_exec command to run in the background. So far I have tried: $ret = shell_exec($ffmpegcmd1." >NUL 2>&1");$ret = shell_exec($ffmpegcmd1." >NUL 2>&1 &");$ret = shell_exec($ffmpegcmd1." >NUL"); without any luck.
View Replies !
Can't Execute Mail() Or Shell_exec, Safe_mode Is OFF.
I'm having a problem executing external commands when the code is executed through the web server (user: www). If I execute the scripts as a user other than www, they all work fine. PHP's safe_mode is OFF. For example, I can send mail in a script when executed in the shell, but the same script when executed through the browser (i.e, using the web server) fails. The same happens with shell_exec. I've verified that other users can execute the scripts. PHP is allowed to create and delete files and all sorts of other things, but calling external commands doesn't work: Here is the debug output from ZDE when trying to send mail: Debug Warning: /includes/HSForms.class.php line 584 - mail(): Could not execute mail delivery program '/usr/sbin/sendmail -t -i ' The sendmail binary has proper privileges... so as far as I can tell, this is not being allowed before that is even tested. To top it all off, this was ALL working great last week.
View Replies !
Shell_exec('service Dhcpd Restart')
i'm trying to run this shell command from inside my php program $output = shell_exec('service dhcpd restart'); echo "<pre>$output</pre>"; this is the output i get: Shutting down dhcpd: [FAILED] Starting dhcpd: that's it.... and when i run it from the shell directly it works fine.. any ideas?
View Replies !
Return False Or Return True
PHP5. Class, Member function. "return false;" or "return true;" When checked in the code invoking the method nothing is returned. If I change to "return(0);" or "return(1);" then it works fine, and the value is returned ok although obviously not technically a boolean. I have tried all sorts, from if ( memberfunction() ) { if ( $val = memberfunction() ) { $val = false; $val = memberfunction(); ......
View Replies !
Exec, Shell_exec, System, And Passthru Not Working At All
Can't get these commands to work! The following page simply doesn't finish loading ( Waiting... Opening... :-( ) <?php echo system("dir"); ?> The same for <?php echo exec("dir"); ?> or <?php echo shell_exec("dir"); ?>, etc... I'm running Apache 2.0.55 & PHP 5.0.5 with Zend Optimizer v2.5.10 on windows XP SP2.
View Replies !
Shell_exec :: Create A .pdf From A Series Of .tiff Images
I am trying to create a .pdf from a series of .tiff images. What images are selected is the product of a query (from Oracle), not a pick-list or traditional means. This is running on Linux so two tools at my disposal are CPTIFF which puts several .tiff images into one file and TIFF2PDF, which takes the output of CPTIFF and creates a .pdf from it. The use of the app will always produce a pdf with multiple images. What I need to be able to do is feed the result of the query to CPTIFF and then the result of CPTIFF to TIFF2PDF. Something like: shell_exec('cptiff image1.tiff image2.tiff image3.tiff all_images.tif'); shell_exec('tiff2pdf -o output.pdf all_images.tif'); The problem: How do I feed the query result to cptiff as a single line separated by blanks. I am used to looping through and creating a table as output, not feeding the results to the OS.
View Replies !
Exec Or Shell_exec For Dumping MySql Info?
I'm trying to figure out how to export info from a Mysql database, using PHP to manage the export, as phpMyAdmin manages to do. I'm guessing I need to run a shell script that looks like this: mysqldump -u username -ppassword database_name FILE.sql and I need to call this shell script using one of the functions on this page: Code:
View Replies !
Shell_exec Using System Tools - Wait For Process To Finish
I have a problem that hopefuly someone here knows the answer to. I want to do a shell_exec command from PHP. I then want to continue with the script when the shell program is finished with what it does. Problem here is, that will take approximately one hour. How do I make the script wait until the program that I call in shell_exec is finished?
View Replies !
Exec And Shell_exec Not Executing Batch File Properly
I am running Apache and PHP on windows XP. Latest versions of them all. I am trying to execute a simple .bat batch file that simply copies 4 files from one location to the batch files location. The php exec command runs like this: V:Corehtdocswp ransfer.bat Y:folder here the batch file is executed and the command following is thrown into the batch file to specify where the files that need to be copied are. The Y: directory is in windows considered to be a network drive, although it is really just a folder on the same machine, i did this because there are spaces in the folder names on its way to where I need the information copied from i.e. "Program Files" When I run this in the command prompt by entering this in manually it runs perfectly. However when running exec in the PHP script nothing happens; when I run shell_exec it gives me the output and it shows that every line in the batch file is executed however it does not actually copy anything. Looking into my apache error log I see that this is related: "The system cannot find the drive specified." Now what I am wondering is, how is it that I can run this script manually but apache tells me I cannot. My permissions are set to allow all and deny nothing since it is a machine well tucked into a safe place. Apache resides on the machine in C: eactorcore and it also setup a virtual drive as v:core. Trying both does not work.
View Replies !
Return A Value
i got a functions and it echos out a result, the problme is if i make the functions into a string it still echos out the result at the spot where the string is at. Code:
View Replies !
Return 0
I have a little function that gets a result from a query when supplied arguments, it works great except when the result is 0. Here's the func : Code:
View Replies !
Return The Key
Been trying to figure out an array issue. For some reason when I echo $key it's echoing "Array". I want it to return the key (in this case adventure). Code:
View Replies !
Return?
What does RETURN actually return if used by it self inside a function? example : <?php # Result Varibles to GLOBALS function globals($rs) { if ( !$rs || !mysql_num_rows($rs) ) { echo "No result"; return; } # WHAT DOES RERUN HERE DO ? $row = mysql_fetch_array($rs);Â
View Replies !
Return()
function check_user() { $sql=mysql_query("select * FROM companies WHERE company_name= '{$_GET['company']}'}"); $result=mysql_fetch_array($sql) if ($_SESSION['id']==$result['id']) { return true; } else { return false; } }
View Replies !
Class Does Not Return A Value
My first time working with a PHP class, and after 6 hours of working out the kinks I am unable to return a value from the class, so now I appeal to the general audience what on earth did I do wrong this time? This is the code the retrieves the values:
View Replies !
|