I am trying to duplicate php's environment using a perl script. The reason is, I use a shared hosting provider, that doesn't have php-cgiwrap or php-suexec, but with suexec for perl. I need my php scripts to run under my username, and not under the server's username (in this case "nobody"). To do so, I have tryed executing php scripts using a wrapper using perl (thus having it use my username), preserving all environment variables, as follows:
Code:
#!/usr/bin/perl
use strict;
use IPC::Open2;
my($reader, $writer);
my $pid = open2($reader, $writer, "/home/cfaun/php-cgi", "-c", "/home/cfaun/php", "test.php");
select $writer;
while(<STDIN>) {
print;
}
close $writer;
select STDOUT;
while (<$reader>) {
print;
}
close $reader;
waitpid $pid, 0;
This works only for simple php scripts, and does not suit my purposes, and I am seeking a way to reticulate the problem. Is there something I am leaving out (do I need certain php.ini settings)? Is there an alternate way of doing this?
Any help would be GREATLY appreciated!
-cfaun