Version: 1.0
Type: Full Script
Category: Other
License: GNU General Public License
Description: AA
#!/usr/bin/perl
#
# phprun - Wrapper Script for running PHP scripts on the command line v1.0
#
# Install in /bin/ directory and chmod 755
#
# Usage:
#
# phprun myscript.php
#
$phpopts="-q";
$php="/usr/local/bin/php";
$php.=" $phpopts";
if (@ARGV[0]) {
$file="FILE";
$withfile=true;
open($file,@ARGV[0]) || die("Problem Opening File : $!");
shift(@ARGV);
while ($arg = shift(@ARGV)) {
$php.=" $arg";
};
} else {
$file="STDIN";
};
open(PHP,"| $php");
while ($rec=<$file>) {
print PHP $rec;
};
if ($withfile) {
close $file;
};
close PHP;