Hi,
I've got the following problem: exec() and shell_exec(), etc. don't give
anything back, just the error code 127 (command not found?!)
For example, the following script:
<?php
exec("cat ./test", $lines, $result);
// or exec("./cat ./test", $lines, $result);
echo "result = $result<br>";
echo "Lines<br>\n";
foreach ($lines as $k => $v) {
echo "k=$k v=$v<br>\n";
}
?>
causes on my homeserver just
result = 127
Lines
whereas the provider's server makes it the right way:
result = 0
Lines
k=0 v=msdflkdsfkldffdf
k=1 v=fdfdlkmdfklfdkflfd
k=2 v=fdfldkkfdklfdlkfdlkfdlkfd
k=3 v=fdfdkfdklfdklfklfdlkdffd
k=4 v=fdfkfdkldfkjdflkfdklfdlkfdf
k=5 v=dfdkldflfdkkdflkflk
System: Debian / Apache 2.0 + PHP 4.3.2 as module
what's wrong?
thanks 5 8939
[ X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 ]
_______________^^^^^^^^^^^^^^^^^^^^^^^^^^^________ ________
PeterF wrote: I've got the following problem: exec() and shell_exec(), etc. don't give anything back, just the error code 127 (command not found?!)
For example, the following script:
<?php exec("cat ./test", $lines, $result);
Do you have a executable file named cat in a directory that's part of
your path?
Open a DOS Prompt window and type "cat autoexec.bat"
After that fails try "type autoexec.bat"
Try
$lastline = exec('type ./test', $lines, $result);
// add last line of output to the $lines array
$lines[] = $lastline;
System: Debian / Apache 2.0 + PHP 4.3.2 as module
This is the host, right?
what's wrong?
Windows is wrong :) -- SCNR
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
huh,
type autoexec.bat?? sorry but I'm working with a Debian webserver
Do you have a executable file named cat in a directory that's part of your path?
yes
thanks
PeterF <NO*************@pf-webservices.de> wrote: Hi,
I've got the following problem: exec() and shell_exec(), etc. don't give anything back, just the error code 127 (command not found?!)
For example, the following script:
<?php exec("cat ./test", $lines, $result);
- have you tried '/bin/cat' (or wherever your cat is, do 'which cat' to
find that out) instead of just 'cat'?
- do other shell commands work?
- or is your web server perhaps chrooted in its own directory? in this
case it won't be able to access /bin/cat or anything else outside the
chroot.
steven
PeterF wrote: huh,
type autoexec.bat?? sorry but I'm working with a Debian webserver
Oops ... I was led astray because of your User-Agent, sorry.
Do you have safe_mode on?
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jerry |
last post by:
I've found a problem with exec, passthru, shell_exec & system.
I'm trying to run the following
exec("sort -r -n -k2,2 r1.txt > r2.txt")
with r1.txt being a numeric file. The file looks like...
|
by: Hemanth |
last post by:
Hello there,
I'm new to PHP. I'm trying to run a simple php
script (on a Red hat linux machine with apache web server )
through a windows web browser (IE).
I'm using an exec() function in my...
|
by: Carlos Ribeiro |
last post by:
Hello all,
I have a module that retrieves code snippets from a database to be
executed on the fly . As I make heavy use of accented characters
inside strings (I'm in Brazil), it came to my...
|
by: kurt.krueckeberg |
last post by:
The second line of this script
<?php
// current directory
echo getcwd() . "<br />";
print ( exec("ls *.*") );
?>
should display the names of the four files (it does in an ssh session)
which...
|
by: Michael |
last post by:
Hi,
I'm having difficulty finding any previous discussion on this -- I
keep finding people either having problems calling os.exec(lepev), or
with using python's exec statement. Neither of...
|
by: comp.lang.tcl |
last post by:
set php {<? print_r("Hello World"); ?>}
puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
puts
When I try this within TCL I get the following error:
|
by: jmuria |
last post by:
Hi.
I'm trying to make a web page to work. It worked before so it has to
be something related with the configuration.
My problem is a call to a compiled executable (made for me) that
returns 1...
|
by: warth33 |
last post by:
Hello
I have a php site. Some page needs to call an external program. The
programs are home made c# applications.
It uses to work without problem. For a while. Maybe it work for some
hour....
|
by: Maarten |
last post by:
Howdy,
Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and
I have a little problem with one function within my cd-management script.
For extracting a bit of info from my...
|
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...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |