Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

passthru(3) [php man page]

PASSTHRU(3)								 1							       PASSTHRU(3)

passthru - Execute an external program and display raw output

SYNOPSIS
void passthru (string $command, [int &$return_var]) DESCRIPTION
The passthru(3) function is similar to the exec(3) function in that it executes a $command. This function should be used in place of exec(3) or system(3) when the output from the Unix command is binary data which needs to be passed directly back to the browser. A common use for this is to execute something like the pbmplus utilities that can output an image stream directly. By setting the Content-type to image/gif and then calling a pbmplus program to output a gif, you can create PHP scripts that output images directly. PARAMETERS
o $command - The command that will be executed. o $return_var - If the $return_var argument is present, the return status of the Unix command will be placed here. RETURN VALUES
No value is returned. NOTES
Warning When allowing user-supplied data to be passed to this function, use escapeshellarg(3) or escapeshellcmd(3) to ensure that users can- not trick the system into executing arbitrary commands. Note If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends. Note When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have .. components in the path to the executable. Warning With safe mode enabled, the command string is escaped with escapeshellcmd(3). Thus, echo y | echo x becomes echo y | echo x. SEE ALSO
exec(3), system(3), popen(3), escapeshellcmd(3), backtick operator. PHP Documentation Group PASSTHRU(3)

Check Out this Related Man Page

EXIT(3) 								 1								   EXIT(3)

exit - Output a message and terminate the current script

SYNOPSIS
void exit ([string $status]) DESCRIPTION
void exit (int $status) Terminates execution of the script. Shutdown functions and object destructors will always be executed even if exit is called. exit is a language construct and it can be called without parentheses if no $status is passed. PARAMETERS
o $status - If $status is a string, this function prints the $status just before exiting. If $status is an integer, that value will be used as the exit status and not printed. Exit statuses should be in the range 0 to 254, the exit status 255 is reserved by PHP and shall not be used. The status 0 is used to terminate the program successfully. Note PHP >= 4.2.0 does NOT print the $status if it is an integer. RETURN VALUES
No value is returned. EXAMPLES
Example #1 exit example <?php $filename = '/path/to/data-file'; $file = fopen($filename, 'r') or exit("unable to open file ($filename)"); ?> Example #2 exit status example <?php //exit program normally exit; exit(); exit(0); //exit with an error code exit(1); exit(0376); //octal ?> Example #3 Shutdown functions and destructors run regardless <?php class Foo { public function __destruct() { echo 'Destruct: ' . __METHOD__ . '()' . PHP_EOL; } } function shutdown() { echo 'Shutdown: ' . __FUNCTION__ . '()' . PHP_EOL; } $foo = new Foo(); register_shutdown_function('shutdown'); exit(); echo 'This will not be output.'; ?> The above example will output: Shutdown: shutdown() Destruct: Foo::__destruct() NOTES
Note Because this is a language construct and not a function, it cannot be called using variable functions. Note This language construct is equivalent to die(3). SEE ALSO
register_shutdown_function(3). PHP Documentation Group EXIT(3)
Man Page