PHP perror extension

Download: http://l-i-e.com/perror/perror_1_0_1.tar.gz

Install: perror/INSTALL (included with Download)

Browse Source: http://l-i-e.com/perror/perror/

This modest extension adds the functions 'strerror' and 'strsignal' for use with 'exec' and friends and pcntl functions.

v 1.0.1 suppresses a warning about int pointer conversion

Example:


			<?php
				exec("ls /root", $output, $error);
				if ($error) die("OS Error: $error = " . strerror($error));
				echo nl2br(implode('', $output));
			?>
		

Output:


			OS Error: 1 = Operation not permitted		

KNOWN BUGS:

Many packages override the default error code meanings.

This is not a bug per se, but the end user of this function will need to provide their own facility to override the default error messages for those codes that are over-ridden.

This extension probably should be folded into main/exec.c at some point, after sufficient testing, and if it is popular enough.


Tested on: FreeBSD 5.3 and 4.11, and RedHat 7

Send comments, especially successful builds, and bug reports to: lynch@php.net