★ wanayoo — archive 1999 http://www.php.net/manual/ja/function.popen.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to ファイルシステム
Quick Reference
English version of this pageGerman version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
ファイルシステム
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fscanf
* fseek
* fstat
* ftell
* ftruncate
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: popen
View the source code for this pageSearch the site



Previous page
 pclose
 Updated
Sat, 12 Aug 2000
readfile 
Next page


popen

(PHP3 , PHP4 )

popen -- プロセスへのファイルポインタをオープンする

説明

int popen (string command, string mode)

commandで与えられたコマンドを fork()して実行し、そのプロセスへのパイプをオープンします。

fopen()により返されたファイルポインタ と同様のものを返しますが、それは(読み書きのいずれか一方で のみ使われる)片方向ストリームであり、pclose() によりクローズされなければならないところが異なります。この ポインタは、fgets(), fgetss() およびfputs()のいずれかで使うことができます。

エラーが起こった場合falseを返します。


$fp = popen ("/bin/ls", "r");
      

pclose()も参照下さい。


User Contributed Notes: popen


christian@theien.net
14-May-2000 07:31
Most commands sends error messages to stderr, but the file descriptor returned by popen only permits reading from stdout. On unix, this can be changed by adding "2>&1" at the end of the command, but there is nothing similiar under DOS. Does anybody know how to get the stderr data from a PHP script?


emccoy@hamilton.edu
16-Jul-2000 05:05
In Windows NT and 2000, at least, the shell interprets "2>&1" as in Unix. You may have to explicitly call cmd.exe (or command.com).


vraravam@thoughtworks.com
20-Jul-2000 09:32
hi,

I am trying to open a process for both reading and writing using 2 streams.

The perl code would be:

$pid = open2($reader, $writer, "cvs server")


Can anybody please tell me how to do this using PHP?

Thanks in advance.



matthew@leftcoast.com
04-Aug-2000 06:46
PHP4 appears to allow w+ for reading and writing..


ie:


<pre>
$fh=popen("/usr/local/sbin/stunnel -c -r secure.host.com:443","w+");
fwrite($fh,"GET /cgi-bin/test.sh HTTP/1.0\n\n");
$foo=fread($fh,8096);

echo "Got <pre>\n$foo\n</pre>";
pclose($fh);
</pre>




 About Notes


Previous page
 pclose
 Updated
Sat, 12 Aug 2000
readfile 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.