Re: Launch vmware server with php script and apache

From: Date: Thu, 13 Mar 2008 16:01:25 +0000
Subject: Re: Launch vmware server with php script and apache
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-271525@lists.php.net to get a copy of this message
On Thu, Mar 13, 2008 at 11:35 AM, Julio César García Vizcaíno <fuego216@gmail.com> wrote: > Hi, > > I'm working with a script which must launch vmware server 1.0.3 > (Virtualization product) and I can launch it from a terminal: > $php miscript.php > but when I use firefox it just doesn't work. [snip!] > > local.php > ------------------------ > <?php > echo "Lanzando vmware\n"; > system('whoami'); > system('/var/www/procesa.pl'); > ?> > ------------------------ Try rewriting the above as follows: <?php error_reporting(E_ALL); echo "Lanzando vmware\n"; exec('whoami',$who_ret); exec('/var/www/procesa.pl',$procesa_ret,$err); echo !isset($argv[0]) ? "<pre />\n" : null; print_r($who_ret); print_r($procesa_ret); echo !isset($argv[0]) ? "</pre>\n" : null; if(isset($err) && $err != 0) { echo "Process launching returned error code ".$err."\n"; } else { echo "Successfully launched!\n"; } ?> However, I'm not really certain why you need to call the Perl script. What I would consider doing myself is the following: <?php exec('whoami',$who); echo "Attempting to launch VMWare process as ".$who.".\n"; exec('/usr/bin/vmware & 2>1',$ret,$err); echo isset($err) && $err != 0 ? "Error code: ".$err."\n" : null; echo > Sorry for my bad english. Your English is better than some of the native speakers we have here, so no need to apologize! ;-P -- </Daniel P. Brown> Forensic Services, Senior Unix Engineer 1+ (570-) 362-0283

« previous php.general (#271525) next »