PHP 5 Power Programming

   »    Book by Andi Gutmans, Stig Sæther Bakken, and Derick Rethans

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Computer Books » PHP » PHP 5 Power Programming »

Here are some examples of command-line tools written in PHP.

PHP Filter Utility
This example includes a little tool for filtering line
by line from standard input through a PHP function that returns a string: (more…)


• • •
 

In UNIX, signals are a basic mechanism to pass messages
between processes. They enable processes to tell each other that some type of
event has just occurred. This type of event is the only information passed to
basic UNIX signal handlers. There is another signal-handling mechanism
called “sigaction” in which signal handlers receive more information, but PHP
signals are based on the former, basic form. For example, if the user presses
Ctrl-c to stop a command-line program, the program receives an interrupt sig-
nal, called SIGINT. (more…)


• • •
 

When one program runs another program, the execution of
the second program is actually a two-step procedure. First, the calling process
forks and makes a duplicate of itself, and then immediately does an exec call
to replace the executable code and memory with that of the new program.
If you just want to run a program and read the output or write to it, there are
easier ways of doing it, such as popen(). But, if you must be able to both read
and write to the program, you need to manually fork and exec from PHP, or
use the proc_open() function. (more…)


• • •
 

Forking is UNIX lingo for making a new process by dupli-
cating an existing one. The duplicate (child) process inherits code, environ-
ment, memory (copy on write), file descriptors, and everything from the parent
process. Often, you either immediately replace the guts of the process by exe-
cuting another executable program, or close inherited file descriptors and pre-
pare the child process for its job: (more…)


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com