473,508 Members | 4,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

popen() doesn't for me


popen() just won't work for me, and there is no debug info to
indicate why in the server logs. Can anyone shed some light on this?
Any suggestions for debugging? Ways to get more info out of "Resource
#2" as shown in the script below?

Safe mode is set to off (verified with php_info, shown via ini_get
below). The server is not chrooted (I can stat the exe in question, as
shown below).

PHP version is 4.3.3 with the following configure line:

../configure --disable-safe-mode --with-imap --with-imap-ssl \
--with-kerberos --with-dom --with-mcrypt --with-zlib --with-apxs

Running as an apache 1.3.27 module under RedHat 7.2.

Any help is appreciated. Thanks!
Test script:

<?PHP
echo "safe_mode is set to " . ini_get("safe_mode") . "<br>\n";
$size = stat("/bin/ls");
echo $size[7] . "<br>\n";
$fp = popen("/bin/ls", "r");
echo "'$fp'; " . gettype($fp) . "<br>\n";
while ($s = fgets($fp,1024)) {
echo $s;
}
echo "s is #$s#<br>\n";
pclose($fp);
?>
Output:

safe_mode is set to 0<br>
45948<br>
'Resource id #2'; resource<br>
s is ##<br>
Verification of /bin/ls size:

$ ls -l /bin/ls
-rwxr-xr-x 1 root root 45948 Aug 9 2001 /bin/ls*
--
gowen -- Greg Owen -- gowen-news at swynwyr.com
79A7 4063 96B6 9974 86CA 3BEF 521C 860F 5A93 D66D
Jul 17 '05 #1
0 1701

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1548
by: M | last post by:
Hi Folks, I would like to use popen and redirect output from a program, except it doesn't seem to work. I am using IIS 5.1 on Windows XP Pro. Error messages are as follows: Warning:...
10
2861
by: Nick Craig-Wood | last post by:
I'm trying to avoid using shell metacharacters in os.popen in a portable fashion. os.popen() only seems to take a string as the command which would need tricky quoting. os.popen2() can take a...
17
5213
by: bastiaannaber | last post by:
I am trying to write a program which uses popen but I have a problem. I want to detect if the program I call with popen has ended. For example: #include <stdio.h> #include <sys/types.h>...
1
5575
by: yichun.wei | last post by:
Perl has the ability to do the following: print <<EOF; ...reams of text goes here... EOF Is there a Python equivalent of the above Perl code? This thread has previous discussion on the...
3
7773
by: Jesse | last post by:
Hi all, I have a problem using wget and Popen. I hope someone can help. -- Problem -- I want to use the command: wget -nv -O "dir/cpan.txt" "http://search.cpan.org" and capture all it's...
3
1702
by: Ratko | last post by:
Hi all, I have a python gui app that launches multiple applications using subprocess.Popen class and prints their output in the gui (using PIPEs, threads and wxPython). Everything works great...
8
4137
by: clyfish | last post by:
In cmd, I can use find like this. C:\>netstat -an | find "445" TCP 0.0.0.0:445 0.0.0.0:0 LISTENING UDP 0.0.0.0:445 *:* C:\> And os.system is OK....
25
2747
by: Jeremy Banks | last post by:
Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the...
1
8537
by: Mark Shewfelt | last post by:
Hello, I am attempting to use Popen() in a Windows service. I have a small Win32 .exe that I normally run through the os.popen2() function. I've written a class to work with the input and output...
5
4116
by: thedsadude | last post by:
Hello, I'm launching a script as follows: <code> p = subprocess.Popen() p.wait() </code> If p.py writes to sys.stdout, then it is shown on the console.
0
7228
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
7128
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...
0
7332
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
7393
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...
1
7058
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...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.