2

I want to execute several commands by PHP,

//DISPLAY setting
$command1 = 'export DISPLAY=:1';    
$last_line1 = system($command , $rtn);

//use Xvfb
$command2 = 'Xvfb :1 -screen 0 '.$width.'x'.$height.'x24 &';
$last_line2 = system($command , $rtn);

//open firefox
$command3 = 'firefox -display :1 -width '.$width.' -height '.$height.' -P "webshot" &';
$last_line3 = system($command , $rtn);

//open URL
$command4 = 'firefox -display :1 -remote "openurl('http://www.google.com')" &';
$last_line4 = system($command , $rtn);

command3 occurs some errors ,but they can ignore. I want to continue to execute command4,but command3 occurs some errors,so it cannot be executed.

How to resolve this problem?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
phicdy
  • 63
  • 5

2 Answers2

1

Define error_reporting(0) at the top of the page.. Though it s not a good programming practice, it s the solution for ur problem

Edwin Alex
  • 5,118
  • 4
  • 28
  • 50
0

I think, you should use a try catch in order to catch exception related to your system command

Userbn
  • 342
  • 1
  • 2