Free Computer Books

   »    Free Computer Books on Computer Programming, Web Development & Designing

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Computer Books »

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…)


• • •
 

Exit Code
If the script fails, exit with a non-0 code (except 255,
which is reserved by PHP itself for compile/parse errors). If the script does not
fail, exit with code 0.
Be aware that earlier PHP versions (pre-4.2) had a bug in the exit code
handling. Exiting in any other way than letting the script finish results in a
“non-true” exit code. (more…)


• • •
 

Command-line options are used in UNIX to specify alternate behavior or addi-
tional parameters for commands. You spot them by the leading dash. Here are
some examples:
$ ls ­ltr
$ rm ­f junk
Usually, options are located before regular parameters (that do not start
with a dash) on the command line. Some commands, such as cvs or pear, have
additional subcommands accepting their own set of options. The PEAR
installer is one such command. (more…)


• • •
 



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